Added shift-clicking back in for water staff. Without it picking up water is impossible.
This commit is contained in:
parent
62e439d66e
commit
fc3657a6f2
1 changed files with 94 additions and 91 deletions
|
|
@ -37,97 +37,99 @@ public class ItemStaffWater extends Item {
|
||||||
itemIcon = iconRegister.registerIcon("MysticTextures:StaffWater");
|
itemIcon = iconRegister.registerIcon("MysticTextures:StaffWater");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int par4, int par5, int par6, int par7, float par8, float par9, float par10){
|
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer){
|
||||||
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, entityPlayer, true);
|
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||||
|
{
|
||||||
|
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, entityPlayer, true);
|
||||||
|
|
||||||
if (movingobjectposition == null)
|
if (movingobjectposition == null)
|
||||||
{
|
{
|
||||||
return true;
|
return itemStack;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE)
|
if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE)
|
||||||
{
|
{
|
||||||
int i = movingobjectposition.blockX;
|
int i = movingobjectposition.blockX;
|
||||||
int j = movingobjectposition.blockY;
|
int j = movingobjectposition.blockY;
|
||||||
int k = movingobjectposition.blockZ;
|
int k = movingobjectposition.blockZ;
|
||||||
|
|
||||||
if (!world.canMineBlock(entityPlayer, i, j, k))
|
if (!world.canMineBlock(entityPlayer, i, j, k))
|
||||||
{
|
{
|
||||||
return true;
|
return itemStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack))
|
if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack))
|
||||||
{
|
{
|
||||||
return true;
|
return itemStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (world.getBlockMaterial(i, j, k) == Material.water && world.getBlockMetadata(i, j, k) == 0)
|
if (world.getBlockMaterial(i, j, k) == Material.water && world.getBlockMetadata(i, j, k) == 0)
|
||||||
{
|
{
|
||||||
world.playSoundEffect((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
|
world.playSoundEffect((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
|
||||||
world.setBlockToAir(i, j, k);
|
world.setBlockToAir(i, j, k);
|
||||||
|
|
||||||
itemStack.damageItem(1, entityPlayer);
|
itemStack.damageItem(1, entityPlayer);
|
||||||
|
|
||||||
return true;
|
return itemStack;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (movingobjectposition.sideHit == 0)
|
if (movingobjectposition.sideHit == 0)
|
||||||
{
|
{
|
||||||
--j;
|
--j;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (movingobjectposition.sideHit == 1)
|
if (movingobjectposition.sideHit == 1)
|
||||||
{
|
{
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (movingobjectposition.sideHit == 2)
|
if (movingobjectposition.sideHit == 2)
|
||||||
{
|
{
|
||||||
--k;
|
--k;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (movingobjectposition.sideHit == 3)
|
if (movingobjectposition.sideHit == 3)
|
||||||
{
|
{
|
||||||
++k;
|
++k;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (movingobjectposition.sideHit == 4)
|
if (movingobjectposition.sideHit == 4)
|
||||||
{
|
{
|
||||||
--i;
|
--i;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (movingobjectposition.sideHit == 5)
|
if (movingobjectposition.sideHit == 5)
|
||||||
{
|
{
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack))
|
if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack))
|
||||||
{
|
{
|
||||||
return true;
|
return itemStack;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int i1 = world.getBlockId(i, j, k);
|
int i1 = world.getBlockId(i, j, k);
|
||||||
|
|
||||||
if (i1 == 0)
|
if (i1 == 0)
|
||||||
{
|
{
|
||||||
world.playSoundEffect((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
|
world.playSoundEffect((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
|
||||||
world.setBlock(i, j, k, Block.waterMoving.blockID);
|
world.setBlock(i, j, k, Block.waterMoving.blockID);
|
||||||
itemStack.damageItem(1, entityPlayer);
|
itemStack.damageItem(1, entityPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return itemStack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer)
|
return itemStack;
|
||||||
{
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
world.playAuxSFXAtEntity((EntityPlayer)null, 1009, (int)entityPlayer.posX, (int)entityPlayer.posY, (int)entityPlayer.posZ, 0);
|
world.playAuxSFXAtEntity((EntityPlayer)null, 1009, (int)entityPlayer.posX, (int)entityPlayer.posY, (int)entityPlayer.posZ, 0);
|
||||||
|
|
||||||
if (!world.isRemote)
|
if (!world.isRemote)
|
||||||
|
|
@ -138,5 +140,6 @@ public class ItemStaffWater extends Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
return itemStack;
|
return itemStack;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue