Update CreativeDagger.java

This commit is contained in:
Arcaratus 2015-03-23 17:48:41 -04:00
parent f0b5353742
commit 0b7d4442ee

View file

@ -8,7 +8,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.common.util.FakePlayer;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar; import WayofTime.alchemicalWizardry.api.tile.IBloodAltar;
public class CreativeDagger extends Item public class CreativeDagger extends Item
{ {
@ -23,25 +23,6 @@ public class CreativeDagger extends Item
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{ {
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
SacrificeKnifeUsedEvent evt = new SacrificeKnifeUsedEvent(par3EntityPlayer, true, true, 2);
if(MinecraftForge.EVENT_BUS.post(evt))
{
return par1ItemStack;
}
if(evt.shouldDrainHealth)
{
par3EntityPlayer.setHealth(par3EntityPlayer.getHealth() - 2);
}
if(!evt.shouldFillAltar)
{
return par1ItemStack;
}
}
if (par3EntityPlayer instanceof FakePlayer) if (par3EntityPlayer instanceof FakePlayer)
{ {
return par1ItemStack; return par1ItemStack;
@ -65,20 +46,7 @@ public class CreativeDagger extends Item
{ {
return par1ItemStack; return par1ItemStack;
} }
if (par3EntityPlayer.isPotionActive(AlchemicalWizardry.customPotionSoulFray))
{
findAndFillAltar(par2World, par3EntityPlayer, Integer.MAX_VALUE); findAndFillAltar(par2World, par3EntityPlayer, Integer.MAX_VALUE);
} else
{
findAndFillAltar(par2World, par3EntityPlayer, Integer.MAX_VALUE);
}
if (par3EntityPlayer.getHealth() <= 0.001f)
{
par3EntityPlayer.onDeath(DamageSource.generic);
}
return par1ItemStack; return par1ItemStack;
} }
@ -87,7 +55,7 @@ public class CreativeDagger extends Item
int posX = (int) Math.round(player.posX - 0.5f); int posX = (int) Math.round(player.posX - 0.5f);
int posY = (int) player.posY; int posY = (int) player.posY;
int posZ = (int) Math.round(player.posZ - 0.5f); int posZ = (int) Math.round(player.posZ - 0.5f);
IBloodAltar altarEntity = getAltar(world, posX, posY, posZ); TEAltar altarEntity = getAltar(world, posX, posY, posZ);
if (altarEntity == null) if (altarEntity == null)
{ {
@ -98,7 +66,7 @@ public class CreativeDagger extends Item
altarEntity.startCycle(); altarEntity.startCycle();
} }
public IBloodAltar getAltar(World world, int x, int y, int z) public TEAltar getAltar(World world, int x, int y, int z)
{ {
TileEntity tileEntity = null; TileEntity tileEntity = null;