From a0c4bb9ec233b5acf7d57d7a81ce0cec3553986d Mon Sep 17 00:00:00 2001 From: fewizz Date: Sat, 13 Jun 2015 17:48:32 +0300 Subject: [PATCH] new config option(to Disable impact of rain), tweaked Shield Focus --- .../common/items/armor/ItemFeatherWing.java | 9 ++- .../armor/ItemThaumiumReinforcedWing.java | 7 +- .../items/armor/wings/ItemNanoWing.java | 6 +- .../items/armor/wings/ItemQuantumWing.java | 7 +- .../common/items/foci/ItemShieldFocus.java | 65 ++++++++++--------- .../emt/common/util/ConfigHandler.java | 2 + 6 files changed, 57 insertions(+), 39 deletions(-) diff --git a/src/main/java/tombenpotter/emt/common/items/armor/ItemFeatherWing.java b/src/main/java/tombenpotter/emt/common/items/armor/ItemFeatherWing.java index b6df29a..cf64ee0 100644 --- a/src/main/java/tombenpotter/emt/common/items/armor/ItemFeatherWing.java +++ b/src/main/java/tombenpotter/emt/common/items/armor/ItemFeatherWing.java @@ -14,6 +14,7 @@ import net.minecraft.world.World; import tombenpotter.emt.ElectroMagicTools; import tombenpotter.emt.ModInformation; import tombenpotter.emt.client.model.ModelWings; +import tombenpotter.emt.common.util.ConfigHandler; public class ItemFeatherWing extends ItemArmor { @@ -58,9 +59,11 @@ public class ItemFeatherWing extends ItemArmor { player.motionY *= 0.9; if (player.isInWater() && !player.capabilities.isCreativeMode) player.motionY = -0.6; - - 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 (isSneaking && !player.onGround) player.motionY = -0.6; } diff --git a/src/main/java/tombenpotter/emt/common/items/armor/ItemThaumiumReinforcedWing.java b/src/main/java/tombenpotter/emt/common/items/armor/ItemThaumiumReinforcedWing.java index 3cfd88b..016bc58 100644 --- a/src/main/java/tombenpotter/emt/common/items/armor/ItemThaumiumReinforcedWing.java +++ b/src/main/java/tombenpotter/emt/common/items/armor/ItemThaumiumReinforcedWing.java @@ -13,6 +13,7 @@ import thaumcraft.api.IVisDiscountGear; import thaumcraft.api.aspects.Aspect; import tombenpotter.emt.ElectroMagicTools; import tombenpotter.emt.ModInformation; +import tombenpotter.emt.common.util.ConfigHandler; import tombenpotter.emt.common.util.TextHelper; import java.util.List; @@ -65,8 +66,10 @@ public class ItemThaumiumReinforcedWing extends ItemFeatherWing implements IVisD if (player.isInWater() && !player.capabilities.isCreativeMode) player.motionY = -0.6; - 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 (isSneaking && !player.onGround) player.motionY = -0.6; diff --git a/src/main/java/tombenpotter/emt/common/items/armor/wings/ItemNanoWing.java b/src/main/java/tombenpotter/emt/common/items/armor/wings/ItemNanoWing.java index a91059d..06f27b3 100644 --- a/src/main/java/tombenpotter/emt/common/items/armor/wings/ItemNanoWing.java +++ b/src/main/java/tombenpotter/emt/common/items/armor/wings/ItemNanoWing.java @@ -78,8 +78,10 @@ public class ItemNanoWing extends ItemThaumiumReinforcedWing implements IElectri if (player.isInWater() && !player.capabilities.isCreativeMode) player.motionY = -0.4; - if ((player.worldObj.isRaining() || player.worldObj.isThundering()) && !player.capabilities.isCreativeMode) - player.motionY = -0.2; + if(ConfigHandler.impactOfRain){ + if ((player.worldObj.isRaining() || player.worldObj.isThundering()) && !player.capabilities.isCreativeMode) + player.motionY = -0.2; + } if (isSneaking && !player.onGround) player.motionY = -0.6; } diff --git a/src/main/java/tombenpotter/emt/common/items/armor/wings/ItemQuantumWing.java b/src/main/java/tombenpotter/emt/common/items/armor/wings/ItemQuantumWing.java index 28d15dc..611c6b6 100644 --- a/src/main/java/tombenpotter/emt/common/items/armor/wings/ItemQuantumWing.java +++ b/src/main/java/tombenpotter/emt/common/items/armor/wings/ItemQuantumWing.java @@ -10,6 +10,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; import tombenpotter.emt.ElectroMagicTools; import tombenpotter.emt.ModInformation; +import tombenpotter.emt.common.util.ConfigHandler; public class ItemQuantumWing extends ItemNanoWing { @@ -50,8 +51,10 @@ public class ItemQuantumWing extends ItemNanoWing { if (player.isInWater() && !player.capabilities.isCreativeMode) player.motionY = -0.1; - if ((player.worldObj.isRaining() || player.worldObj.isThundering()) && !player.capabilities.isCreativeMode) - player.motionY = -0.05; + if(ConfigHandler.impactOfRain){ + if ((player.worldObj.isRaining() || player.worldObj.isThundering()) && !player.capabilities.isCreativeMode) + player.motionY = -0.05; + } if (isSneaking && isHoldingJump) player.motionY = 0; diff --git a/src/main/java/tombenpotter/emt/common/items/foci/ItemShieldFocus.java b/src/main/java/tombenpotter/emt/common/items/foci/ItemShieldFocus.java index ce40842..3b2de3e 100644 --- a/src/main/java/tombenpotter/emt/common/items/foci/ItemShieldFocus.java +++ b/src/main/java/tombenpotter/emt/common/items/foci/ItemShieldFocus.java @@ -27,6 +27,7 @@ import tombenpotter.emt.common.blocks.BlockRegistry; public class ItemShieldFocus extends ItemBaseFocus { int y1 = 0; + ItemStack milk; private static final AspectList visCost = new AspectList().add(Aspect.ORDER, 10).add(Aspect.WATER, 10).add(Aspect.AIR, 10); @@ -56,49 +57,53 @@ public class ItemShieldFocus extends ItemBaseFocus { @Override public void onUsingFocusTick(ItemStack itemstack, EntityPlayer player, int count) { - ItemWandCasting wand = (ItemWandCasting) itemstack.getItem(); + if (wand.consumeAllVis(itemstack, player, getVisCost(itemstack), true, true)) { player.motionX = 0.0D; - player.motionY = -0.1D; + if(!player.capabilities.isCreativeMode && player.motionY < 0) + player.motionY = player.motionY / 2; player.motionZ = 0.0D; int x = MathHelper.floor_double(player.posX); int y = MathHelper.floor_double(player.posY); int z = MathHelper.floor_double(player.posZ); - ItemStack milk = (new ItemStack(Items.milk_bucket)); + if(milk == null)milk = (new ItemStack(Items.milk_bucket)); player.curePotionEffects(milk); - - // Player Level - if (player.worldObj.isAirBlock(x + 1, y, z) && player.worldObj.isAirBlock(x - 1, y, z) && player.worldObj.isAirBlock(x, y, z + 1) && player.worldObj.isAirBlock(x, y, z - 1)) { - player.worldObj.setBlock(x + 1, y, z, BlockRegistry.shield); - player.worldObj.setBlock(x - 1, y, z, BlockRegistry.shield); - player.worldObj.setBlock(x, y, z + 1, BlockRegistry.shield); - player.worldObj.setBlock(x, y, z - 1, BlockRegistry.shield); - } - - // Above the player - if (player.worldObj.isAirBlock(x + 1, y + 1, z) && player.worldObj.isAirBlock(x - 1, y + 1, z) && player.worldObj.isAirBlock(x, y + 1, z + 1) && player.worldObj.isAirBlock(x, y + 1, z - 1)) { - player.worldObj.setBlock(x + 1, y + 1, z, BlockRegistry.shield); - player.worldObj.setBlock(x - 1, y + 1, z, BlockRegistry.shield); - player.worldObj.setBlock(x, y + 1, z + 1, BlockRegistry.shield); - player.worldObj.setBlock(x, y + 1, z - 1, BlockRegistry.shield); - } - if (y > y1 && (player.worldObj.isAirBlock(x + 1, y - 2, z) && player.worldObj.isAirBlock(x - 1, y - 2, z) && player.worldObj.isAirBlock(x, y - 2, z + 1) && player.worldObj.isAirBlock(x, y - 2, z - 1)) || (player.worldObj.getBlock(x + 1, y - 2, z) == BlockRegistry.shield && player.worldObj.getBlock(x - 1, y - 2, z) == BlockRegistry.shield && player.worldObj.getBlock(x, y - 2, z + 1) == BlockRegistry.shield && player.worldObj.getBlock(x, y - 2, z - 1) == BlockRegistry.shield)){ - player.worldObj.setBlockToAir(x + 1, y - 2, z); - player.worldObj.setBlockToAir(x - 1, y - 2, z); - player.worldObj.setBlockToAir(x, y - 2, z + 1); - player.worldObj.setBlockToAir(x, y - 2, z - 1); - } + + if(player.motionY > -5){ + // Player Level + if (player.worldObj.isAirBlock(x + 1, y, z) && player.worldObj.isAirBlock(x - 1, y, z) && player.worldObj.isAirBlock(x, y, z + 1) && player.worldObj.isAirBlock(x, y, z - 1)) { + player.worldObj.setBlock(x + 1, y, z, BlockRegistry.shield); + player.worldObj.setBlock(x - 1, y, z, BlockRegistry.shield); + player.worldObj.setBlock(x, y, z + 1, BlockRegistry.shield); + player.worldObj.setBlock(x, y, z - 1, BlockRegistry.shield); + } + + // Above the player + if (player.worldObj.isAirBlock(x + 1, y + 1, z) && player.worldObj.isAirBlock(x - 1, y + 1, z) && player.worldObj.isAirBlock(x, y + 1, z + 1) && player.worldObj.isAirBlock(x, y + 1, z - 1)) { + player.worldObj.setBlock(x + 1, y + 1, z, BlockRegistry.shield); + player.worldObj.setBlock(x - 1, y + 1, z, BlockRegistry.shield); + player.worldObj.setBlock(x, y + 1, z + 1, BlockRegistry.shield); + player.worldObj.setBlock(x, y + 1, z - 1, BlockRegistry.shield); + } - if (y < y1 && (player.worldObj.isAirBlock(x + 1, y + 2, z) && player.worldObj.isAirBlock(x - 1, y + 2, z) && player.worldObj.isAirBlock(x, y + 2, z + 1) && player.worldObj.isAirBlock(x, y + 2, z - 1)) || (player.worldObj.getBlock(x + 1, y + 2, z) == BlockRegistry.shield && player.worldObj.getBlock(x - 1, y + 2, z) == BlockRegistry.shield && player.worldObj.getBlock(x, y + 2, z + 1) == BlockRegistry.shield && player.worldObj.getBlock(x, y + 2, z - 1) == BlockRegistry.shield)){ - player.worldObj.setBlockToAir(x + 1, y + 2, z); - player.worldObj.setBlockToAir(x - 1, y + 2, z); - player.worldObj.setBlockToAir(x, y + 2, z + 1); - player.worldObj.setBlockToAir(x, y + 2, z - 1); + if (y > y1 && (player.worldObj.isAirBlock(x + 1, y - 2, z) && player.worldObj.isAirBlock(x - 1, y - 2, z) && player.worldObj.isAirBlock(x, y - 2, z + 1) && player.worldObj.isAirBlock(x, y - 2, z - 1)) || (player.worldObj.getBlock(x + 1, y - 2, z) == BlockRegistry.shield && player.worldObj.getBlock(x - 1, y - 2, z) == BlockRegistry.shield && player.worldObj.getBlock(x, y - 2, z + 1) == BlockRegistry.shield && player.worldObj.getBlock(x, y - 2, z - 1) == BlockRegistry.shield)){ + player.worldObj.setBlockToAir(x + 1, y - 2, z); + player.worldObj.setBlockToAir(x - 1, y - 2, z); + player.worldObj.setBlockToAir(x, y - 2, z + 1); + player.worldObj.setBlockToAir(x, y - 2, z - 1); + } + + if (y < y1 && (player.worldObj.isAirBlock(x + 1, y + 2, z) && player.worldObj.isAirBlock(x - 1, y + 2, z) && player.worldObj.isAirBlock(x, y + 2, z + 1) && player.worldObj.isAirBlock(x, y + 2, z - 1)) || (player.worldObj.getBlock(x + 1, y + 2, z) == BlockRegistry.shield && player.worldObj.getBlock(x - 1, y + 2, z) == BlockRegistry.shield && player.worldObj.getBlock(x, y + 2, z + 1) == BlockRegistry.shield && player.worldObj.getBlock(x, y + 2, z - 1) == BlockRegistry.shield)){ + player.worldObj.setBlockToAir(x + 1, y + 2, z); + player.worldObj.setBlockToAir(x - 1, y + 2, z); + player.worldObj.setBlockToAir(x, y + 2, z + 1); + player.worldObj.setBlockToAir(x, y + 2, z - 1); + } } y1 = y; diff --git a/src/main/java/tombenpotter/emt/common/util/ConfigHandler.java b/src/main/java/tombenpotter/emt/common/util/ConfigHandler.java index 3d7a4c5..2f4f8a2 100644 --- a/src/main/java/tombenpotter/emt/common/util/ConfigHandler.java +++ b/src/main/java/tombenpotter/emt/common/util/ConfigHandler.java @@ -43,6 +43,7 @@ public class ConfigHandler { public static double outputCap; // random stuff + public static boolean impactOfRain; public static boolean capesOn; public static boolean toolsInBore; public static boolean nightVisionOff; @@ -129,6 +130,7 @@ public class ConfigHandler { chanceTaintedMjolnir = config.get(CATEGORY_RANDOM, "Tainted Mjolnir spawning change", 25, "If you have a lot of mods adding dungeon loot, you should definetely increase this").getInt(); chanceOneRing = config.get(CATEGORY_RANDOM, "One Ring spawning chance", 15, "If you have a lot of mods adding dungeon loot, you should definetely increase this").getInt(); removeAmberAndCinnabarMacerating = config.get(CATEGORY_RANDOM, "Clear Amber/Cinnabar Macerating", true, "This is here because of conflicts between mods that add the same input and different outputs").getBoolean(removeAmberAndCinnabarMacerating); + impactOfRain = config.get(CATEGORY_RANDOM, "Impact of rain", true, "The impact of rain on all wings").getBoolean(impactOfRain); // DEFAULTS - Aer - 15,000 Aqua - 5,000 Ignis - 20,000 Ordo - 16,000 Perditio - 10,000 Terra - 2,000 airOutput = config.get(CATEGORY_OUTPUTS, "Aer Output", 15000).getDouble(airOutput);