From af0217153d90f5c3fb34c6f5e012a21440bb5325 Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Wed, 22 Jan 2020 10:12:36 -0600 Subject: [PATCH] Fix cell blocks not respecting getEffectivePos --- .../subtile/generating/SubTileDandelifeon.java | 3 +-- .../botania/common/block/tile/TileCell.java | 15 ++++++--------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileDandelifeon.java b/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileDandelifeon.java index 725c79354..171d3701b 100644 --- a/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileDandelifeon.java +++ b/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileDandelifeon.java @@ -62,7 +62,6 @@ public class SubTileDandelifeon extends TileEntityGeneratingFlower { private void runSimulation() { int[][] table = getCellTable(); List changes = new ArrayList<>(); - new ArrayList(); boolean wipe = false; for(int i = 0; i < table.length; i++) @@ -178,7 +177,7 @@ public class SubTileDandelifeon extends TileEntityGeneratingFlower { if(gen < 0) world.removeBlock(pos, false); else ((TileCell) tile).setGeneration(this, gen); - } else if(gen >= 0 && blockAt.isAir(stateAt, getWorld(), pos)) { + } else if(gen >= 0 && stateAt.isAir(getWorld(), pos)) { world.setBlockState(pos, ModBlocks.cellBlock.getDefaultState()); tile = world.getTileEntity(pos); ((TileCell) tile).setGeneration(this, gen); diff --git a/src/main/java/vazkii/botania/common/block/tile/TileCell.java b/src/main/java/vazkii/botania/common/block/tile/TileCell.java index 2bae52d6c..cea5e580c 100644 --- a/src/main/java/vazkii/botania/common/block/tile/TileCell.java +++ b/src/main/java/vazkii/botania/common/block/tile/TileCell.java @@ -15,6 +15,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.math.BlockPos; import net.minecraftforge.registries.ObjectHolder; +import vazkii.botania.common.block.subtile.generating.SubTileDandelifeon; import vazkii.botania.common.lib.LibBlockNames; import vazkii.botania.common.lib.LibMisc; @@ -40,22 +41,18 @@ public class TileCell extends TileMod { super(TYPE); } - public void setGeneration(TileEntity flower, int gen) { + public void setGeneration(SubTileDandelifeon flower, int gen) { generation = gen; if(!ticked) { - flowerCoords = flower.getPos(); + flowerCoords = flower.getEffectivePos(); validCoords = getPos(); ticked = true; - } else if(!matchCoords(validCoords, this) || !matchCoords(flowerCoords, flower)) + } else if(!validCoords.equals(getPos()) || !flowerCoords.equals(flower.getEffectivePos())) world.removeBlock(pos, false); } - public boolean isSameFlower(TileEntity flower) { - return matchCoords(validCoords, this) && matchCoords(flowerCoords, flower); - } - - private boolean matchCoords(BlockPos coords, TileEntity tile) { - return coords.equals(tile.getPos()); + public boolean isSameFlower(SubTileDandelifeon flower) { + return validCoords.equals(getPos()) && flowerCoords.equals(flower.getEffectivePos()); } public int getGeneration() {