Fix cell blocks not respecting getEffectivePos

This commit is contained in:
Vincent Lee committed 2020-01-22 10:12:49 -06:00
1 parent 07916b13ed
commit af0217153d
2 files changed
+7 -11

No files matched your search

@@ -62,7 +62,6 @@ public class SubTileDandelifeon extends TileEntityGeneratingFlower {
private void runSimulation() {
int[][] table = getCellTable();
List<int[]> 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);
@@ -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() {