Fixed the Dandelifeon being able to generate mana from cells ticked by other Dandelifeons. Closes #1511

This commit is contained in:
Vasco Lavos committed 2015-11-03 21:34:34 +00:00
1 parent 2d8c3fa2e2
commit dbf5ea0d0d
2 files changed
+7 -1

No files matched your search

@@ -166,7 +166,9 @@ public class SubTileDandelifeon extends SubTileGenerating {
Block blockAt = world.getBlock(x, y, z);
if(gen == -2) {
int val = prevGen * MANA_PER_GEN;
mana = Math.min(getMaxMana(), mana + val);
if(((TileCell) world.getTileEntity(x, y, z)).isSameFlower(supertile))
mana = Math.min(getMaxMana(), mana + val);
world.setBlockToAir(x, y, z);
} else if(blockAt == ModBlocks.cellBlock) {
if(gen < 0 || gen > MAX_GENERATIONS)
@@ -49,6 +49,10 @@ public class TileCell extends TileMod {
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
}
public boolean isSameFlower(TileEntity flower) {
return matchCoords(validCoords, this) && matchCoords(flowerCoords, flower);
}
private boolean matchCoords(ChunkCoordinates coords, TileEntity tile) {
return coords.posX == tile.xCoord && coords.posY == tile.yCoord && coords.posZ == tile.zCoord;
}