From fbba25d5ad3cbb92aac9b9dc8eee946e66ce22c0 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 7 Jan 2016 15:56:57 +0100 Subject: [PATCH] The growth ring now only uses RF when growing stuff --- .../mod/items/ItemGrowthRing.java | 28 +++++++++++-------- .../mod/items/ItemMagnetRing.java | 3 ++ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java index c34cfaae0..9135bb0cc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java @@ -47,7 +47,7 @@ public class ItemGrowthRing extends ItemEnergy{ EntityPlayer player = (EntityPlayer)entity; ItemStack equipped = player.getCurrentEquippedItem(); - int energyUse = 550; + int energyUse = 50; if(equipped != null && equipped == stack && this.getEnergyStored(stack) >= energyUse){ ArrayList blocks = new ArrayList(); @@ -76,14 +76,23 @@ public class ItemGrowthRing extends ItemEnergy{ //Fertilizing the Blocks if(!blocks.isEmpty()){ for(int i = 0; i < 45; i++){ - Position pos = blocks.get(Util.RANDOM.nextInt(blocks.size())); + if(this.getEnergyStored(stack) >= energyUse){ + Position pos = blocks.get(Util.RANDOM.nextInt(blocks.size())); - int metaBefore = pos.getMetadata(world); - pos.getBlock(world).updateTick(world, pos.getX(), pos.getY(), pos.getZ(), Util.RANDOM); + int metaBefore = pos.getMetadata(world); + pos.getBlock(world).updateTick(world, pos.getX(), pos.getY(), pos.getZ(), Util.RANDOM); - //Show Particles if Metadata changed - if(pos.getMetadata(world) != metaBefore){ - world.playAuxSFX(2005, pos.getX(), pos.getY(), pos.getZ(), 0); + //Show Particles if Metadata changed + if(pos.getMetadata(world) != metaBefore){ + world.playAuxSFX(2005, pos.getX(), pos.getY(), pos.getZ(), 0); + } + + if(!player.capabilities.isCreativeMode){ + this.extractEnergy(stack, energyUse, false); + } + } + else{ + break; } } } @@ -93,11 +102,6 @@ public class ItemGrowthRing extends ItemEnergy{ else{ stack.stackTagCompound.setInteger("WaitTime", waitTime+1); } - - //Use Energy every tick - if(!player.capabilities.isCreativeMode){ - this.extractEnergy(stack, energyUse, false); - } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java index af77c09ef..0dcc27f6b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java @@ -61,6 +61,9 @@ public class ItemMagnetRing extends ItemEnergy{ } } } + else{ + break; + } } } }