diff --git a/Xplat/src/main/java/vazkii/botania/api/block_entity/SpecialFlowerBlockEntity.java b/Xplat/src/main/java/vazkii/botania/api/block_entity/SpecialFlowerBlockEntity.java index 19ced5b950..0caf6dbe20 100644 --- a/Xplat/src/main/java/vazkii/botania/api/block_entity/SpecialFlowerBlockEntity.java +++ b/Xplat/src/main/java/vazkii/botania/api/block_entity/SpecialFlowerBlockEntity.java @@ -123,7 +123,7 @@ public final void setFloating(boolean floating) { this.isFloating = floating; } - private boolean isOnSpecialSoil() { + public boolean isOnSpecialSoil() { if (isFloating()) { return false; } else { diff --git a/Xplat/src/main/java/vazkii/botania/common/block/block_entity/CellularBlockEntity.java b/Xplat/src/main/java/vazkii/botania/common/block/block_entity/CellularBlockEntity.java index 7bc298b590..9a0ff9610c 100644 --- a/Xplat/src/main/java/vazkii/botania/common/block/block_entity/CellularBlockEntity.java +++ b/Xplat/src/main/java/vazkii/botania/common/block/block_entity/CellularBlockEntity.java @@ -67,8 +67,8 @@ public void update(Level level) { generation = nextGeneration; } - public boolean hasPoweredParent(Level level) { - return flowerCoords != null && level.getBlockEntity(flowerCoords) instanceof DandelifeonBlockEntity && level.hasNeighborSignal(flowerCoords); + public boolean hasActiveParent(DandelifeonBlockEntity dandie) { + return flowerCoords != null && dandie.getLevel().getBlockEntity(flowerCoords) instanceof DandelifeonBlockEntity parent && dandie.getLevel().hasNeighborSignal(flowerCoords) && (!dandie.overgrowthBoost || parent.isOnSpecialSoil()); } public int getGeneration() { diff --git a/Xplat/src/main/java/vazkii/botania/common/block/flower/generating/DandelifeonBlockEntity.java b/Xplat/src/main/java/vazkii/botania/common/block/flower/generating/DandelifeonBlockEntity.java index cb74ba7fb7..abba8d3dcf 100644 --- a/Xplat/src/main/java/vazkii/botania/common/block/flower/generating/DandelifeonBlockEntity.java +++ b/Xplat/src/main/java/vazkii/botania/common/block/flower/generating/DandelifeonBlockEntity.java @@ -26,6 +26,7 @@ public class DandelifeonBlockEntity extends GeneratingFlowerBlockEntity { public static final int RANGE = 12; public static final int SPEED = 10; + public static final int OVERGROWN_SPEED = SPEED / 2; // private static final int MAX_GENERATIONS = 100; public static final int MAX_MANA_GENERATIONS = 100; public static final int MANA_PER_GEN = 60; @@ -58,9 +59,9 @@ public void tickFlower() { super.tickFlower(); if (!getLevel().isClientSide) { - if (getLevel().getGameTime() % SPEED == 0 && getLevel().hasNeighborSignal(getBlockPos())) { + if (shouldTick(getLevel().getGameTime())) { runSimulation(); - } else if ((getLevel().getGameTime() + 1) % SPEED == 0) { + } else if (shouldTick(getLevel().getGameTime() + 1)) { int diameter = radius * 2; for (int i = 0; i <= diameter; i++) { @@ -76,6 +77,10 @@ public void tickFlower() { } } + private boolean shouldTick(long gameTime) { + return (gameTime % SPEED == 0 || (gameTime % (OVERGROWN_SPEED) == 0 && overgrowthBoost)) && getLevel().hasNeighborSignal(getBlockPos()); + } + private void runSimulation() { var table = new CellTable(radius, this); List changes = new ArrayList<>(); @@ -186,7 +191,7 @@ public CellTable(int range, DandelifeonBlockEntity dandie) { private static int getCellGeneration(BlockPos pos, DandelifeonBlockEntity dandie, boolean onBoundary) { BlockEntity tile = dandie.getLevel().getBlockEntity(pos); if (tile instanceof CellularBlockEntity cell) { - return onBoundary ? (cell.hasPoweredParent(dandie.getLevel()) ? Cell.boundaryPunish(cell.getGeneration()) : Cell.DEAD) : cell.getGeneration(); + return onBoundary ? (cell.hasActiveParent(dandie) ? Cell.boundaryPunish(cell.getGeneration()) : Cell.DEAD) : cell.getGeneration(); } return Cell.DEAD;