-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
140 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/main/java/mod/emt/harkenscythe/entities/HSEntityBlood.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package mod.emt.harkenscythe.entities; | ||
|
||
import mod.emt.harkenscythe.init.HSItems; | ||
import mod.emt.harkenscythe.items.HSEssenceKeeper; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.init.SoundEvents; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.EnumHand; | ||
import net.minecraft.util.EnumParticleTypes; | ||
import net.minecraft.util.SoundCategory; | ||
import net.minecraft.world.World; | ||
|
||
public class HSEntityBlood extends HSEntityEssence | ||
{ | ||
public HSEntityBlood(World worldIn) | ||
{ | ||
super(worldIn); | ||
} | ||
|
||
@Override | ||
public boolean processInitialInteract(EntityPlayer player, EnumHand hand) | ||
{ | ||
ItemStack stack = player.getHeldItem(hand); | ||
Item item = stack.getItem(); | ||
if (item instanceof HSEssenceKeeper) | ||
{ | ||
if (!player.capabilities.isCreativeMode) | ||
{ | ||
if (item == HSItems.essence_keeper || item == HSItems.essence_vessel) | ||
{ | ||
stack.shrink(1); | ||
ItemStack newStack = item == HSItems.essence_keeper ? new ItemStack(HSItems.essence_keeper_blood) : new ItemStack(HSItems.essence_vessel_blood); | ||
newStack.setItemDamage(newStack.getMaxDamage() - 1); | ||
player.setHeldItem(hand, newStack); | ||
} | ||
else if (item == HSItems.essence_keeper_blood || item == HSItems.essence_vessel_blood) | ||
{ | ||
if (stack.getItemDamage() == 0) return false; | ||
if (stack.getItemDamage() > 0) | ||
{ | ||
stack.setItemDamage(stack.getItemDamage() - 1); | ||
} | ||
if (stack.getItemDamage() <= 0) | ||
{ | ||
stack.shrink(1); | ||
ItemStack newStack = item == HSItems.essence_keeper_blood ? new ItemStack(HSItems.essence_keeper_blood) : new ItemStack(HSItems.essence_vessel_blood); | ||
player.setHeldItem(hand, newStack); | ||
} | ||
} | ||
} | ||
this.world.playSound(null, player.getPosition(), SoundEvents.ITEM_BOTTLE_FILL_DRAGONBREATH, SoundCategory.PLAYERS, 1.0F, 1.0F); | ||
this.world.spawnParticle(EnumParticleTypes.CLOUD, this.posX, this.posY + 1.5D, this.posZ, 0.0D, 0.1D, 0.0D); | ||
this.setDead(); | ||
} | ||
return super.processInitialInteract(player, hand); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/main/java/mod/emt/harkenscythe/entities/HSEntitySoul.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package mod.emt.harkenscythe.entities; | ||
|
||
import mod.emt.harkenscythe.init.HSItems; | ||
import mod.emt.harkenscythe.items.HSEssenceKeeper; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.init.SoundEvents; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.EnumHand; | ||
import net.minecraft.util.EnumParticleTypes; | ||
import net.minecraft.util.SoundCategory; | ||
import net.minecraft.world.World; | ||
|
||
public class HSEntitySoul extends HSEntityEssence | ||
{ | ||
public HSEntitySoul(World worldIn) | ||
{ | ||
super(worldIn); | ||
} | ||
|
||
@Override | ||
public boolean processInitialInteract(EntityPlayer player, EnumHand hand) | ||
{ | ||
ItemStack stack = player.getHeldItem(hand); | ||
Item item = stack.getItem(); | ||
if (item instanceof HSEssenceKeeper) | ||
{ | ||
if (!player.capabilities.isCreativeMode) | ||
{ | ||
if (item == HSItems.essence_keeper || item == HSItems.essence_vessel) | ||
{ | ||
stack.shrink(1); | ||
ItemStack newStack = item == HSItems.essence_keeper ? new ItemStack(HSItems.essence_keeper_soul) : new ItemStack(HSItems.essence_vessel_soul); | ||
newStack.setItemDamage(newStack.getMaxDamage() - 1); | ||
player.setHeldItem(hand, newStack); | ||
} | ||
else if (item == HSItems.essence_keeper_soul || item == HSItems.essence_vessel_soul) | ||
{ | ||
if (stack.getItemDamage() == 0) return false; | ||
if (stack.getItemDamage() > 0) | ||
{ | ||
stack.setItemDamage(stack.getItemDamage() - 1); | ||
} | ||
if (stack.getItemDamage() <= 0) | ||
{ | ||
stack.shrink(1); | ||
ItemStack newStack = item == HSItems.essence_keeper_soul ? new ItemStack(HSItems.essence_keeper_soul) : new ItemStack(HSItems.essence_vessel_soul); | ||
player.setHeldItem(hand, newStack); | ||
} | ||
} | ||
} | ||
this.world.playSound(null, player.getPosition(), SoundEvents.ITEM_BOTTLE_FILL_DRAGONBREATH, SoundCategory.PLAYERS, 1.0F, 1.0F); | ||
this.world.spawnParticle(EnumParticleTypes.CLOUD, this.posX, this.posY + 1.5D, this.posZ, 0.0D, 0.1D, 0.0D); | ||
this.setDead(); | ||
} | ||
return super.processInitialInteract(player, hand); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters