From ba22dbb69b0c08ed1e2428aaaace5f46b6412caf Mon Sep 17 00:00:00 2001 From: fewizz Date: Wed, 9 Sep 2015 23:32:58 +0300 Subject: [PATCH] Fixed hoe, chainsaw of the stream. Cleanup. --- build.gradle | 3 + build.properties | 2 +- .../common/items/armor/ItemEMTQuantum.java | 88 +++++++++++-------- .../items/armor/wings/ItemFeatherWing.java | 67 +++++++------- .../items/tools/ItemElectricHoeGrowth.java | 6 +- .../tools/chainsaws/ItemStreamChainsaw.java | 2 +- 6 files changed, 93 insertions(+), 75 deletions(-) diff --git a/build.gradle b/build.gradle index b3e69a6..978c8d0 100644 --- a/build.gradle +++ b/build.gradle @@ -70,6 +70,9 @@ jar { "Implementation-Version": project.version, "Git-Hash": gitHash ) + exclude "baubles/**" + exclude "ic2/**" + exclude "thaumcraft/**" } // add a source jar diff --git a/build.properties b/build.properties index d56c816..f5eaa0d 100644 --- a/build.properties +++ b/build.properties @@ -3,5 +3,5 @@ package_group=com.tombenpotter.emt mc_version=1.7.10 forge_version=10.13.4.1481 -mod_version=1.2.0 +mod_version=1.2.0B1 mod_name=ElectroMagicTools diff --git a/src/main/java/tombenpotter/emt/common/items/armor/ItemEMTQuantum.java b/src/main/java/tombenpotter/emt/common/items/armor/ItemEMTQuantum.java index ad50b12..5b612e0 100644 --- a/src/main/java/tombenpotter/emt/common/items/armor/ItemEMTQuantum.java +++ b/src/main/java/tombenpotter/emt/common/items/armor/ItemEMTQuantum.java @@ -143,7 +143,7 @@ public class ItemEMTQuantum extends ItemArmorElectric { boolean jetpackUsed = false; String useother = nbtData.getString("useother"); - if(!useother.equals("TW") && !useother.equals("NW") && !useother.equalsIgnoreCase("QW") && !useother.equals("Jetpack") && !useother.equals("None")){ + if(!useother.equals("TW") && !useother.equals("NW") && !useother.equals("QW") && !useother.equals("Jetpack") && !useother.equals("None")){ nbtData.setString("useother", "None"); } @@ -164,7 +164,7 @@ public class ItemEMTQuantum extends ItemArmorElectric { } if(player.inventory.getCurrentItem() != null){ - if(IC2.keyboard.isSneakKeyDown(player) && (player.inventory.getCurrentItem().getUnlocalizedName().equals("ic2.itemArmorJetpackElectric")) && toggleTimer == 0 && nbtData.getString("useother").equals("None")){ + if(IC2.keyboard.isSneakKeyDown(player) && (player.inventory.getCurrentItem().getUnlocalizedName().equals("ic2.itemArmorJetpackElectric")) && toggleTimer == 0 && useother.equals("None")){ toggleTimer = 30; if (IC2.platform.isSimulating()) { player.inventory.armorInventory[2].stackTagCompound.setBoolean("jetpack", true); @@ -179,7 +179,7 @@ public class ItemEMTQuantum extends ItemArmorElectric { } if(player.inventory.getCurrentItem() != null){ - if(IC2.keyboard.isSneakKeyDown(player) && player.inventory.getCurrentItem().getItem() == ItemRegistry.thaumiumWing && toggleTimer == 0 && nbtData.getString("useother").equals("None")){ + if(IC2.keyboard.isSneakKeyDown(player) && player.inventory.getCurrentItem().getItem() == ItemRegistry.thaumiumWing && toggleTimer == 0 && useother.equals("None")){ toggleTimer = 30; if (IC2.platform.isSimulating()) { IC2.platform.messagePlayer(player, "Thaumium wings enabled.", new Object[0]); @@ -192,7 +192,7 @@ public class ItemEMTQuantum extends ItemArmorElectric { } if(player.inventory.getCurrentItem() != null){ - if(IC2.keyboard.isSneakKeyDown(player) && player.inventory.getCurrentItem().getItem() == ItemRegistry.nanoWing && toggleTimer == 0 && nbtData.getString("useother").equals("None")){ + if(IC2.keyboard.isSneakKeyDown(player) && player.inventory.getCurrentItem().getItem() == ItemRegistry.nanoWing && toggleTimer == 0 && useother.equals("None")){ toggleTimer = 30; if (IC2.platform.isSimulating()) { IC2.platform.messagePlayer(player, "Nano wings enabled.", new Object[0]); @@ -206,7 +206,7 @@ public class ItemEMTQuantum extends ItemArmorElectric { } if(player.inventory.getCurrentItem() != null){ - if(IC2.keyboard.isSneakKeyDown(player) && player.inventory.getCurrentItem().getItem() == ItemRegistry.quantumWing && toggleTimer == 0 && nbtData.getString("useother").equals("None")){ + if(IC2.keyboard.isSneakKeyDown(player) && player.inventory.getCurrentItem().getItem() == ItemRegistry.quantumWing && toggleTimer == 0 && useother.equals("None")){ toggleTimer = 30; if (IC2.platform.isSimulating()) { IC2.platform.messagePlayer(player, "Quantum wings enabled.", new Object[0]); @@ -223,7 +223,7 @@ public class ItemEMTQuantum extends ItemArmorElectric { toggleTimer = 30; if(player.inventory.armorInventory[2] == itemStack){ if(player.inventory.getCurrentItem() == null){ - if(player.inventory.armorInventory[2].stackTagCompound.getString("useother").equals("Jetpack")){ + if(useother.equals("Jetpack")){ IC2.platform.messagePlayer(player, "Jetpack disabled.", new Object[0]); jetpack = false; player.inventory.armorInventory[2].stackTagCompound.setString("useother", "None"); @@ -235,13 +235,13 @@ public class ItemEMTQuantum extends ItemArmorElectric { player.inventory.setInventorySlotContents(player.inventory.currentItem, charged); } - if(player.inventory.armorInventory[2].stackTagCompound.getString("useother").equals("TW")){ + if(useother.equals("TW")){ IC2.platform.messagePlayer(player, "Thaumium wings disabled.", new Object[0]); player.inventory.armorInventory[2].stackTagCompound.setString("useother", "None"); player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(ItemRegistry.thaumiumWing)); } - if(player.inventory.armorInventory[2].stackTagCompound.getString("useother").equals("NW")){ + if(useother.equals("NW")){ IC2.platform.messagePlayer(player, "Nano wings disabled.", new Object[0]); player.inventory.armorInventory[2].stackTagCompound.setString("useother", "None"); ItemStack charged = new ItemStack(ItemRegistry.nanoWing); @@ -252,7 +252,7 @@ public class ItemEMTQuantum extends ItemArmorElectric { player.inventory.setInventorySlotContents(player.inventory.currentItem, charged); } - if(player.inventory.armorInventory[2].stackTagCompound.getString("useother").equals("QW")){ + if(useother.equals("QW")){ IC2.platform.messagePlayer(player, "Quantum wings disabled.", new Object[0]); player.inventory.armorInventory[2].stackTagCompound.setString("useother", "None"); ItemStack charged = new ItemStack(ItemRegistry.quantumWing); @@ -268,19 +268,19 @@ public class ItemEMTQuantum extends ItemArmorElectric { } } - if ((jetpack) && ((IC2.keyboard.isJumpKeyDown(player)) && (player.inventory.armorInventory[2].stackTagCompound.getString("useother").equals("Jetpack")) || ((hoverMode) && (player.motionY < -0.029999999329447746D)))) { + if ((jetpack) && ((IC2.keyboard.isJumpKeyDown(player)) && (useother.equals("Jetpack")) || ((hoverMode) && (player.motionY < -0.029999999329447746D)))) { jetpackUsed = useJetpack(player, hoverMode, itemStack); } - if ((player.inventory.armorInventory[2].stackTagCompound.getString("useother").equals("TW"))) { + if ((useother.equals("TW"))) { useWings(player, itemStack, world, 0.15f, 0.7f, 0.5f, false); } - if ((player.inventory.armorInventory[2].stackTagCompound.getString("useother").equals("NW"))) { + if ((useother.equals("NW"))) { useWings(player, itemStack, world, 0.25f, 0.6f, 0.3f, true); } - if ((player.inventory.armorInventory[2].stackTagCompound.getString("useother").equals("QW"))) { + if ((useother.equals("QW"))) { useWings(player, itemStack, world, 0.33f, 0.5f, 0.2f, true); } @@ -326,16 +326,17 @@ public class ItemEMTQuantum extends ItemArmorElectric { @Override public IIcon getIconIndex(ItemStack stack){ try{ - if((stack.stackTagCompound.getString("useother")).equals("Jetpack")){ + String useother = stack.stackTagCompound.getString("useother"); + if(useother.equals("Jetpack")){ return icon1; } - if((stack.stackTagCompound.getString("useother")).equals("TW")){ + if(useother.equals("TW")){ return icon2; } - if((stack.stackTagCompound.getString("useother")).equals("NW")){ + if(useother.equals("NW")){ return icon3; } - if((stack.stackTagCompound.getString("useother")).equals("QW")){ + if(useother.equals("QW")){ return icon4; } } @@ -349,16 +350,17 @@ public class ItemEMTQuantum extends ItemArmorElectric { @Override public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining){ try{ - if((stack.stackTagCompound.getString("useother")).equals("Jetpack")){ + String useother = stack.stackTagCompound.getString("useother"); + if(useother.equals("Jetpack")){ return icon1; } - if((stack.stackTagCompound.getString("useother")).equals("TW")){ + if(useother.equals("TW")){ return icon2; } - if((stack.stackTagCompound.getString("useother")).equals("NW")){ + if(useother.equals("NW")){ return icon3; } - if((stack.stackTagCompound.getString("useother")).equals("QW")){ + if(useother.equals("QW")){ return icon4; } } @@ -381,16 +383,17 @@ public class ItemEMTQuantum extends ItemArmorElectric { @Override @SideOnly(Side.CLIENT) public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { - if((stack.stackTagCompound.getString("useother")).equals("Jetpack")){ + String useother = stack.stackTagCompound.getString("useother"); + if(useother.equals("Jetpack")){ return ModInformation.texturePath + ":textures/models/quantum_jetpack.png"; } - if((stack.stackTagCompound.getString("useother")).equals("TW")){ + if(useother.equals("TW")){ return ModInformation.texturePath + ":textures/models/quantum_wings_t.png"; } - if((stack.stackTagCompound.getString("useother")).equals("NW")){ + if(useother.equals("NW")){ return ModInformation.texturePath + ":textures/models/quantum_wings_n.png"; } - if((stack.stackTagCompound.getString("useother")).equals("QW")){ + if(useother.equals("QW")){ return ModInformation.texturePath + ":textures/models/quantum_wings_q.png"; } return ModInformation.texturePath + ":textures/models/quantum.png"; @@ -398,29 +401,36 @@ public class ItemEMTQuantum extends ItemArmorElectric { @Override @SideOnly(Side.CLIENT) - public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack stack, int armorSlot) { - if((stack.stackTagCompound.getString("useother")).equals("Jetpack")){ - ModelCpecialArmor mbm = new ModelCpecialArmor(1, 1); - return mbm; - } - if((stack.stackTagCompound.getString("useother")).equals("TW") || (stack.stackTagCompound.getString("useother")).equals("NW") || (stack.stackTagCompound.getString("useother")).equals("QW")){ - ModelCpecialArmor mbm = new ModelCpecialArmor(1, 2); - mbm.isJumping = stack.stackTagCompound.getBoolean("isJumping"); - return mbm; - } - return super.getArmorModel(entityLiving, stack, armorSlot); + public ModelBiped getArmorModel(EntityLivingBase entity, ItemStack stack, int armorSlot) { + try{ + if(entity instanceof EntityPlayer){ + String useother = stack.stackTagCompound.getString("useother"); + if(useother.equals("Jetpack")){ + ModelCpecialArmor mbm = new ModelCpecialArmor(1, 1); + return mbm; + } + if(useother.equals("TW") || useother.equals("NW") || useother.equals("QW")){ + ModelCpecialArmor mbm = new ModelCpecialArmor(1, 2); + mbm.isJumping = stack.stackTagCompound.getBoolean("isJumping"); + return mbm; + } + } + } + catch(NullPointerException e){new ModelCpecialArmor(1, 0);} + return new ModelCpecialArmor(1, 0); } @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { try{ - if((stack.stackTagCompound.getString("useother")).equals("Jetpack")){ + String useother = stack.stackTagCompound.getString("useother"); + if(useother.equals("Jetpack")){ list.add((stack.stackTagCompound.getInteger("jetpackCharge")) + " EU JETPACK"); } - if((stack.stackTagCompound.getString("useother")).equals("NW")){ + if(useother.equals("NW")){ list.add((stack.stackTagCompound.getInteger("NWCharge")) + " EU NW"); } - if((stack.stackTagCompound.getString("useother")).equals("QW")){ + if(useother.equals("QW")){ list.add((stack.stackTagCompound.getInteger("QWCharge")) + " EU QW"); } } diff --git a/src/main/java/tombenpotter/emt/common/items/armor/wings/ItemFeatherWing.java b/src/main/java/tombenpotter/emt/common/items/armor/wings/ItemFeatherWing.java index 1166a7d..2784645 100644 --- a/src/main/java/tombenpotter/emt/common/items/armor/wings/ItemFeatherWing.java +++ b/src/main/java/tombenpotter/emt/common/items/armor/wings/ItemFeatherWing.java @@ -50,11 +50,14 @@ public class ItemFeatherWing extends ItemArmor { @Override @SideOnly(Side.CLIENT) public ModelBiped getArmorModel(EntityLivingBase entity, ItemStack stack, int armorSlot) { - if(entity instanceof EntityPlayer){ - ModelWings mw = new ModelWings(); - mw.isJumping = stack.stackTagCompound.getBoolean("isJumping"); - return mw; + try{ + if(entity instanceof EntityPlayer){ + ModelWings mw = new ModelWings(); + mw.isJumping = stack.stackTagCompound.getBoolean("isJumping"); + return mw; + } } + catch(NullPointerException e){return new ModelWings();} return new ModelWings(); } @@ -65,40 +68,42 @@ public class ItemFeatherWing extends ItemArmor { public void updateWings(EntityPlayer player, ItemStack stack, World world, float motionY, float motionXZ, float f1){ NBTTagCompound nbtData = StackUtil.getOrCreateNbtData(stack); + boolean isJmuping = nbtData.getBoolean("isJumping"); + boolean isHolding = nbtData.getBoolean("isHolding"); + int f = nbtData.getInteger("f"); nbtData.setBoolean("isJumping", IC2.keyboard.isJumpKeyDown(player)); - if(nbtData.getBoolean("isJumping")){ - nbtData.setBoolean("isHolding", true); - nbtData.setInteger("f", nbtData.getInteger("f") + 1); - if(nbtData.getInteger("f") > 7) nbtData.setInteger("f", 7); - } - else if(nbtData.getBoolean("isHolding")){ - nbtData.setBoolean("isHolding", false); + if(isJmuping){ + nbtData.setBoolean("isHolding", true); + nbtData.setInteger("f", f + 1); + if(nbtData.getInteger("f") > 7) nbtData.setInteger("f", 7); + } + else if(isHolding){ + nbtData.setBoolean("isHolding", false); - player.motionY = motionY * nbtData.getInteger("f"); - if(player.motionX < 0.7 && player.motionZ < 0.7){ - player.motionX /= motionXZ; - player.motionZ /= motionXZ; - } - world.playSoundEffect(player.posX, player.posY, player.posZ, "mob.ghast.fireball", 1, 1); - for(int i = 0; i < 4; i++){ - world.spawnParticle("cloud", player.posX - 1 + (rnd.nextInt(100) / 50d), player.posY - 1, player.posZ - 1 + (rnd.nextInt(100) / 50d), 0, -0.5, 0); - } - nbtData.setInteger("f", 0); - } + player.motionY = motionY * f; + if(player.motionX < 0.7 && player.motionZ < 0.7){ + player.motionX /= motionXZ; + player.motionZ /= motionXZ; + } + world.playSoundEffect(player.posX, player.posY, player.posZ, "mob.ghast.fireball", 1, 1); + for(int i = 0; i < 4; i++){ + world.spawnParticle("cloud", player.posX - 1 + (rnd.nextInt(100) / 50d), player.posY - 1, player.posZ - 1 + (rnd.nextInt(100) / 50d), 0, -0.5, 0); + } + nbtData.setInteger("f", 0); + } - if (nbtData.getBoolean("isJumping") && !player.onGround && player.motionY < 0) - player.motionY *= f1; - - if (player.isInWater() && !player.capabilities.isCreativeMode) player.motionY += -0.2; + if (isJmuping && !player.onGround && player.motionY < 0) + player.motionY *= f1; + if (player.isInWater() && !player.capabilities.isCreativeMode) player.motionY += -0.2; - if(ConfigHandler.impactOfRain){ - if ((player.worldObj.isRaining() || player.worldObj.isThundering()) && !player.capabilities.isCreativeMode) - player.motionY = -0.3; - } + if(ConfigHandler.impactOfRain){ + if ((player.worldObj.isRaining() || player.worldObj.isThundering()) && !player.capabilities.isCreativeMode) + player.motionY = -0.3; + } - if (player.isSneaking() && !player.onGround) player.motionY = -0.6; + if (player.isSneaking() && !player.onGround) player.motionY = -0.6; if (player.fallDistance > 0.0F) player.fallDistance = 0; } diff --git a/src/main/java/tombenpotter/emt/common/items/tools/ItemElectricHoeGrowth.java b/src/main/java/tombenpotter/emt/common/items/tools/ItemElectricHoeGrowth.java index b37b39a..9cc4d30 100644 --- a/src/main/java/tombenpotter/emt/common/items/tools/ItemElectricHoeGrowth.java +++ b/src/main/java/tombenpotter/emt/common/items/tools/ItemElectricHoeGrowth.java @@ -39,7 +39,7 @@ import java.util.List; public class ItemElectricHoeGrowth extends ItemHoe implements IElectricItem { public IIcon icon; - public int maxCharge = 1000000; + public int maxCharge = 10000; public int growthCost = 1000; public int tillCost = 100; @@ -83,13 +83,13 @@ public class ItemElectricHoeGrowth extends ItemHoe implements IElectricItem { @Override public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10) { - if(ElectricItem.manager.getCharge(stack) > 10000){ + if(ElectricItem.manager.getCharge(stack) > 50){ + ElectricItem.manager.discharge(stack, 50, 2, true, false, false); boolean did = false; for (int x1 = -1; x1 <= 1; x1++) { for (int z1 = -1; z1 <= 1; z1++) { if (super.onItemUse(stack, player, world, x + x1, y, z + z1, par7, par8, par9, par10)) { - ElectricItem.manager.discharge(stack, 250, 2, true, false, false); Thaumcraft.proxy.blockSparkle(world, x + x1, y, z + z1, 8401408, 2); if (!did) { did = true; diff --git a/src/main/java/tombenpotter/emt/common/items/tools/chainsaws/ItemStreamChainsaw.java b/src/main/java/tombenpotter/emt/common/items/tools/chainsaws/ItemStreamChainsaw.java index 3324658..7324318 100644 --- a/src/main/java/tombenpotter/emt/common/items/tools/chainsaws/ItemStreamChainsaw.java +++ b/src/main/java/tombenpotter/emt/common/items/tools/chainsaws/ItemStreamChainsaw.java @@ -68,7 +68,7 @@ public class ItemStreamChainsaw extends ItemThaumiumChainsaw { @Override public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10) { Block bi = world.getBlock(x, y, z); - if ((!player.isSneaking()) && (Utils.isWoodLog(world, x, y, z))) { + if ((!player.isSneaking()) && (Utils.isWoodLog(world, x, y, z)) && ElectricItem.manager.getCharge(itemstack) > cost) { if (!world.isRemote) { if (BlockUtils.breakFurthestBlock(world, x, y, z, bi, player)) { world.playSoundEffect(x, y, z, "thaumcraft:bubble", 0.15F, 1.0F);