From 62e439d66ef66b4ae711c88e3925ae7253a0c162 Mon Sep 17 00:00:00 2001 From: allstar69 Date: Tue, 2 Jul 2013 00:51:00 -0700 Subject: [PATCH] removed shift-clicking from the staves that place blocks or effect blocks. works perfect without it. --- common/MysticWorld/Items/ItemStaffEarth.java | 50 +++--- common/MysticWorld/Items/ItemStaffEnegy.java | 96 ++++++----- common/MysticWorld/Items/ItemStaffFire.java | 82 +++++----- common/MysticWorld/Items/ItemStaffWater.java | 163 +++++++++---------- 4 files changed, 188 insertions(+), 203 deletions(-) diff --git a/common/MysticWorld/Items/ItemStaffEarth.java b/common/MysticWorld/Items/ItemStaffEarth.java index 66ca166..e220228 100644 --- a/common/MysticWorld/Items/ItemStaffEarth.java +++ b/common/MysticWorld/Items/ItemStaffEarth.java @@ -42,40 +42,36 @@ public class ItemStaffEarth extends Item { } public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int par4, int par5, int par6, int par7, float par8, float par9, float par10){ - if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + if (!entityPlayer.canPlayerEdit(par4, par5, par6, par7, itemStack)) { - if (!entityPlayer.canPlayerEdit(par4, par5, par6, par7, itemStack)) - { - return false; - } - else - { - if (applyBonemeal(itemStack, world, par4, par5, par6, entityPlayer)) - { - if (!world.isRemote) - { - world.playAuxSFX(2005, par4, par5, par6, 0); - } - return true; - } - return false; - } + return false; + } + else + { + if (applyBonemeal(itemStack, world, par4, par5, par6, entityPlayer)) + { + if (!world.isRemote) + { + world.playAuxSFX(2005, par4, par5, par6, 0); + } + return true; + } + return false; } - return true; } public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer) { - 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) - { - world.spawnEntityInWorld(new EntityChargeEarth(world, entityPlayer)); - - itemStack.damageItem(1, entityPlayer); - } - - return itemStack; + if (!world.isRemote) + { + world.spawnEntityInWorld(new EntityChargeEarth(world, entityPlayer)); + + itemStack.damageItem(1, entityPlayer); + } + + return itemStack; } public static boolean applyBonemeal(ItemStack itemStack, World par1World, int par2, int par3, int par4, EntityPlayer player) diff --git a/common/MysticWorld/Items/ItemStaffEnegy.java b/common/MysticWorld/Items/ItemStaffEnegy.java index c5bdcb8..004601e 100644 --- a/common/MysticWorld/Items/ItemStaffEnegy.java +++ b/common/MysticWorld/Items/ItemStaffEnegy.java @@ -29,71 +29,67 @@ public class ItemStaffEnegy extends Item{ } public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int par4, int par5, int par6, int par7, float par8, float par9, float par10){ - if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) - { - if (par7 == 0) - { - --par5; - } + if (par7 == 0) + { + --par5; + } - if (par7 == 1) - { - ++par5; - } + if (par7 == 1) + { + ++par5; + } - if (par7 == 2) - { - --par6; - } + if (par7 == 2) + { + --par6; + } - if (par7 == 3) - { - ++par6; - } + if (par7 == 3) + { + ++par6; + } - if (par7 == 4) - { - --par4; - } + if (par7 == 4) + { + --par4; + } - if (par7 == 5) - { - ++par4; - } + if (par7 == 5) + { + ++par4; + } - if (!entityPlayer.canPlayerEdit(par4, par5, par6, par7, itemStack)) - { - return false; - } - else - { - int i1 = world.getBlockId(par4, par5, par6); + if (!entityPlayer.canPlayerEdit(par4, par5, par6, par7, itemStack)) + { + return false; + } + else + { + int i1 = world.getBlockId(par4, par5, par6); - if (i1 == 0) - { - world.playSoundEffect((double)par4 + 0.5D, (double)par5 + 0.5D, (double)par6 + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); - world.setBlock(par4, par5, par6, BlockHandler.lightCube.blockID); - } + if (i1 == 0) + { + world.playSoundEffect((double)par4 + 0.5D, (double)par5 + 0.5D, (double)par6 + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); + world.setBlock(par4, par5, par6, BlockHandler.lightCube.blockID); + } - itemStack.damageItem(1, entityPlayer); - return true; - } - } - return true; + itemStack.damageItem(1, entityPlayer); + return true; + } } public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer) { world.playAuxSFXAtEntity((EntityPlayer)null, 1009, (int)entityPlayer.posX, (int)entityPlayer.posY, (int)entityPlayer.posZ, 0); - if (!world.isRemote) - { - world.spawnEntityInWorld(new EntityChargeEnergy(world, entityPlayer)); - - itemStack.damageItem(1, entityPlayer); - } + if (!world.isRemote) + { + world.spawnEntityInWorld(new EntityChargeEnergy(world, entityPlayer)); - return itemStack; + itemStack.damageItem(1, entityPlayer); + } + + return itemStack; } } diff --git a/common/MysticWorld/Items/ItemStaffFire.java b/common/MysticWorld/Items/ItemStaffFire.java index dee70c1..00bbfab 100644 --- a/common/MysticWorld/Items/ItemStaffFire.java +++ b/common/MysticWorld/Items/ItemStaffFire.java @@ -56,57 +56,53 @@ public class ItemStaffFire extends Item { } public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int par4, int par5, int par6, int par7, float par8, float par9, float par10){ - if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) - { - if (par7 == 0) - { - --par5; - } + if (par7 == 0) + { + --par5; + } - if (par7 == 1) - { - ++par5; - } + if (par7 == 1) + { + ++par5; + } - if (par7 == 2) - { - --par6; - } + if (par7 == 2) + { + --par6; + } - if (par7 == 3) - { - ++par6; - } + if (par7 == 3) + { + ++par6; + } - if (par7 == 4) - { - --par4; - } + if (par7 == 4) + { + --par4; + } - if (par7 == 5) - { - ++par4; - } + if (par7 == 5) + { + ++par4; + } - if (!entityPlayer.canPlayerEdit(par4, par5, par6, par7, itemStack)) - { - return false; - } - else - { - int i1 = world.getBlockId(par4, par5, par6); + if (!entityPlayer.canPlayerEdit(par4, par5, par6, par7, itemStack)) + { + return false; + } + else + { + int i1 = world.getBlockId(par4, par5, par6); - if (i1 == 0) - { - world.playSoundEffect((double)par4 + 0.5D, (double)par5 + 0.5D, (double)par6 + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); - world.setBlock(par4, par5, par6, Block.fire.blockID); - } + if (i1 == 0) + { + world.playSoundEffect((double)par4 + 0.5D, (double)par5 + 0.5D, (double)par6 + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); + world.setBlock(par4, par5, par6, Block.fire.blockID); + } - itemStack.damageItem(1, entityPlayer); - return true; - } - } - return true; + itemStack.damageItem(1, entityPlayer); + return true; + } } public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer) diff --git a/common/MysticWorld/Items/ItemStaffWater.java b/common/MysticWorld/Items/ItemStaffWater.java index 3939deb..107d25c 100644 --- a/common/MysticWorld/Items/ItemStaffWater.java +++ b/common/MysticWorld/Items/ItemStaffWater.java @@ -37,99 +37,97 @@ public class ItemStaffWater extends Item { itemIcon = iconRegister.registerIcon("MysticTextures:StaffWater"); } - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer){ - if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) - { - MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, entityPlayer, true); + public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int par4, int par5, int par6, int par7, float par8, float par9, float par10){ + MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, entityPlayer, true); - if (movingobjectposition == null) - { - return itemStack; - } - else - { - if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) - { - int i = movingobjectposition.blockX; - int j = movingobjectposition.blockY; - int k = movingobjectposition.blockZ; + if (movingobjectposition == null) + { + return true; + } + else + { + if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) + { + int i = movingobjectposition.blockX; + int j = movingobjectposition.blockY; + int k = movingobjectposition.blockZ; - if (!world.canMineBlock(entityPlayer, i, j, k)) - { - return itemStack; - } + if (!world.canMineBlock(entityPlayer, i, j, k)) + { + return true; + } - if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack)) - { - return itemStack; - } + if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack)) + { + return true; + } - 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.setBlockToAir(i, j, k); - - itemStack.damageItem(1, entityPlayer); - - return itemStack; - } - else - { - if (movingobjectposition.sideHit == 0) - { - --j; - } + 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.setBlockToAir(i, j, k); + + itemStack.damageItem(1, entityPlayer); + + return true; + } + else + { + if (movingobjectposition.sideHit == 0) + { + --j; + } - if (movingobjectposition.sideHit == 1) - { - ++j; - } + if (movingobjectposition.sideHit == 1) + { + ++j; + } - if (movingobjectposition.sideHit == 2) - { - --k; - } + if (movingobjectposition.sideHit == 2) + { + --k; + } - if (movingobjectposition.sideHit == 3) - { - ++k; - } + if (movingobjectposition.sideHit == 3) + { + ++k; + } - if (movingobjectposition.sideHit == 4) - { - --i; - } + if (movingobjectposition.sideHit == 4) + { + --i; + } - if (movingobjectposition.sideHit == 5) - { - ++i; - } + if (movingobjectposition.sideHit == 5) + { + ++i; + } - if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack)) - { - return itemStack; - } - else - { - int i1 = world.getBlockId(i, j, k); + if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack)) + { + return true; + } + else + { + int i1 = world.getBlockId(i, j, k); - 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.setBlock(i, j, k, Block.waterMoving.blockID); - itemStack.damageItem(1, entityPlayer); - } - - return itemStack; - } - } - } - - return itemStack; - } - } - else - { + 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.setBlock(i, j, k, Block.waterMoving.blockID); + itemStack.damageItem(1, entityPlayer); + } + + return true; + } + } + } + } + return true; + } + + public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer) + { world.playAuxSFXAtEntity((EntityPlayer)null, 1009, (int)entityPlayer.posX, (int)entityPlayer.posY, (int)entityPlayer.posZ, 0); if (!world.isRemote) @@ -140,6 +138,5 @@ public class ItemStaffWater extends Item { } return itemStack; - } } } \ No newline at end of file