From ce8061261b126b4be90eb11fe9815db913aa2bf1 Mon Sep 17 00:00:00 2001 From: Shadows_of_Fire Date: Thu, 4 Jan 2018 14:51:19 -0500 Subject: [PATCH] grow some more to account for speed loss --- .../mod/blocks/BlockGreenhouseGlass.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java index 1feae64bb..622254292 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java @@ -77,18 +77,25 @@ public class BlockGreenhouseGlass extends BlockBase { public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) { if (world.isRemote) return; - if (rand.nextInt(2) == 0 && world.canBlockSeeSky(pos) && world.isDaytime()) { + if (world.canBlockSeeSky(pos) && world.isDaytime()) { + + System.out.println("debugg"); - Triple trip = firstSolidBlock(world, pos); + Triple trip = firstBlock(world, pos); + boolean once = false; + + for(int i = 0; i < 3; i++) if (trip != null && trip.getRight().canGrow(world, trip.getLeft(), trip.getMiddle(), false)) { trip.getRight().grow(world, rand, trip.getLeft(), trip.getMiddle()); - world.playEvent(2005, trip.getMiddle().isOpaqueCube() ? trip.getLeft().up() : trip.getLeft(), 0); + once = true; } + + if(once) world.playEvent(2005, trip.getMiddle().isOpaqueCube() ? trip.getLeft().up() : trip.getLeft(), 0); } } - public static Triple firstSolidBlock(World world, BlockPos glassPos) { + public static Triple firstBlock(World world, BlockPos glassPos) { BlockPos.MutableBlockPos mut = new BlockPos.MutableBlockPos(glassPos); while (true) { mut.setPos(mut.getX(), mut.getY() - 1, mut.getZ());