From fdc6cd38c6d159c7ecfa9553284e2e3d553d27ff Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 4 Nov 2018 17:13:53 +0100 Subject: [PATCH] make the flower generator stop generating if there's enough aura in the arae --- .../blocks/tiles/TileEntityFlowerGenerator.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFlowerGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFlowerGenerator.java index d926bc61..5a61a11f 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFlowerGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFlowerGenerator.java @@ -58,11 +58,14 @@ public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickab IBlockState state = this.world.getBlockState(pos); MutableInt curr = this.consumedRecently.computeIfAbsent(state, s -> new MutableInt()); - int toAdd = Math.max(0, 50 - curr.getValue()); + int addAmount = 100; + int toAdd = Math.max(0, addAmount - curr.getValue()); if (toAdd > 0) { BlockPos auraPos = AuraChunk.getLowestSpot(this.world, this.pos, 30, this.pos); - AuraChunk auraChunk = AuraChunk.getAuraChunk(this.world, auraPos); - auraChunk.storeAura(auraPos, toAdd); + if (AuraChunk.getAuraInArea(this.world, auraPos, 30) < 20000) + AuraChunk.getAuraChunk(this.world, auraPos).storeAura(auraPos, toAdd); + else + toAdd = 0; } for (Map.Entry entry : this.consumedRecently.entrySet()) { @@ -76,7 +79,7 @@ public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickab this.world.setBlockToAir(pos); - int color = Helper.blendColors(0x5ccc30, 0xe53c16, toAdd / 50F); + int color = Helper.blendColors(0x5ccc30, 0xe53c16, toAdd / (float) addAmount); if (toAdd > 0) { for (int i = this.world.rand.nextInt(5) + 5; i >= 0; i--) PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticleStream(