mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 03:15:07 +00:00
Fixed some Dandelifeon exploits.
This commit is contained in:
1 parent
89faffed7d
commit
e009903771
4 files changed
+55
-7
No files matched your search
+8
-5
@@ -29,7 +29,7 @@ public class SubTileDandelifeon extends SubTileGenerating {
|
||||
private static final int RANGE = 12;
|
||||
private static final int SPEED = 10;
|
||||
private static final int MAX_GENERATIONS = 60;
|
||||
private static final int MANA_PER_GEN = 80;
|
||||
private static final int MANA_PER_GEN = 50;
|
||||
|
||||
private static final int[][] ADJACENT_BLOCKS = new int[][] {
|
||||
{ -1, -1 },
|
||||
@@ -69,9 +69,12 @@ public class SubTileDandelifeon extends SubTileGenerating {
|
||||
newVal = gen + 1;
|
||||
}
|
||||
|
||||
if(Math.abs(i - RANGE) <= 1 && Math.abs(j - RANGE) <= 1 && newVal > -1) {
|
||||
int xdist = Math.abs(i - RANGE);
|
||||
int zdist = Math.abs(j - RANGE);
|
||||
int allowDist = newVal == 1 ? 2 : 1;
|
||||
if(xdist <= allowDist && zdist <= allowDist && newVal > -1) {
|
||||
gen = newVal;
|
||||
newVal = -2;
|
||||
newVal = gen == 1 ? -1 : -2;
|
||||
}
|
||||
|
||||
if(newVal != gen)
|
||||
@@ -162,10 +165,10 @@ public class SubTileDandelifeon extends SubTileGenerating {
|
||||
} else if(blockAt == ModBlocks.cellBlock) {
|
||||
if(gen < 0 || gen > MAX_GENERATIONS)
|
||||
world.setBlockToAir(x, y, z);
|
||||
else ((TileCell) world.getTileEntity(x, y, z)).setGeneration(gen);
|
||||
else ((TileCell) world.getTileEntity(x, y, z)).setGeneration(supertile, gen);
|
||||
} else if(gen >= 0 && blockAt.isAir(supertile.getWorldObj(), x, y, z)) {
|
||||
world.setBlock(x, y, z, ModBlocks.cellBlock);
|
||||
((TileCell) world.getTileEntity(x, y, z)).setGeneration(gen);
|
||||
((TileCell) world.getTileEntity(x, y, z)).setGeneration(supertile, gen);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,20 +11,46 @@
|
||||
package vazkii.botania.common.block.tile;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
|
||||
public class TileCell extends TileMod {
|
||||
|
||||
private static final String TAG_GENERATION = "generation";
|
||||
private static final String TAG_TICKED = "ticked";
|
||||
private static final String TAG_FLOWER_X = "flowerX";
|
||||
private static final String TAG_FLOWER_Y = "flowerY";
|
||||
private static final String TAG_FLOWER_Z = "flowerZ";
|
||||
private static final String TAG_VALID_X = "validX";
|
||||
private static final String TAG_VALID_Y = "validY";
|
||||
private static final String TAG_VALID_Z = "validZ";
|
||||
|
||||
private int generation;
|
||||
private boolean ticked;
|
||||
private ChunkCoordinates flowerCoords = new ChunkCoordinates();
|
||||
private ChunkCoordinates validCoords = new ChunkCoordinates();
|
||||
|
||||
@Override
|
||||
public boolean canUpdate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setGeneration(int gen) {
|
||||
public void setGeneration(TileEntity flower, int gen) {
|
||||
generation = gen;
|
||||
if(!ticked) {
|
||||
flowerCoords.posX = flower.xCoord;
|
||||
flowerCoords.posY = flower.yCoord;
|
||||
flowerCoords.posZ = flower.zCoord;
|
||||
validCoords.posX = xCoord;
|
||||
validCoords.posY = yCoord;
|
||||
validCoords.posZ = zCoord;
|
||||
ticked = true;
|
||||
} else if(!matchCoords(validCoords, this) || !matchCoords(flowerCoords, flower))
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
private boolean matchCoords(ChunkCoordinates coords, TileEntity tile) {
|
||||
return coords.posX == tile.xCoord && coords.posY == tile.yCoord && coords.posZ == tile.zCoord;
|
||||
}
|
||||
|
||||
public int getGeneration() {
|
||||
@@ -34,11 +60,29 @@ public class TileCell extends TileMod {
|
||||
@Override
|
||||
public void writeCustomNBT(NBTTagCompound cmp) {
|
||||
cmp.setInteger(TAG_GENERATION, generation);
|
||||
cmp.setBoolean(TAG_TICKED, ticked);
|
||||
if(ticked) {
|
||||
cmp.setInteger(TAG_FLOWER_X, flowerCoords.posX);
|
||||
cmp.setInteger(TAG_FLOWER_Y, flowerCoords.posY);
|
||||
cmp.setInteger(TAG_FLOWER_Z, flowerCoords.posZ);
|
||||
cmp.setInteger(TAG_VALID_X, validCoords.posX);
|
||||
cmp.setInteger(TAG_VALID_Y, validCoords.posY);
|
||||
cmp.setInteger(TAG_VALID_Z, validCoords.posZ);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readCustomNBT(NBTTagCompound cmp) {
|
||||
generation = cmp.getInteger(TAG_GENERATION);
|
||||
ticked = cmp.getBoolean(TAG_TICKED);
|
||||
if(ticked) {
|
||||
flowerCoords.posX = cmp.getInteger(TAG_FLOWER_X);
|
||||
flowerCoords.posY = cmp.getInteger(TAG_FLOWER_Y);
|
||||
flowerCoords.posZ = cmp.getInteger(TAG_FLOWER_Z);
|
||||
validCoords.posX = cmp.getInteger(TAG_VALID_X);
|
||||
validCoords.posY = cmp.getInteger(TAG_VALID_Y);
|
||||
validCoords.posZ = cmp.getInteger(TAG_VALID_Z);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -566,7 +566,7 @@ public final class LexiconData {
|
||||
spectrolus.setLexiconPages(new PageText("0"), new PageText("1"), new PagePetalRecipe("2", ModPetalRecipes.spectrolusRecipe));
|
||||
|
||||
dandelifeon = new ALexiconEntry(LibLexicon.GFLOWER_DANDELIFEON, categoryGenerationFlowers);
|
||||
dandelifeon.setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2"), new PageText("3"), new PageText("4"), new PageText("5"), new PageText("6"), new PageText("7"), new PagePetalRecipe("8", ModPetalRecipes.dandelifeonRecipe), new PageCraftingRecipe("9", ModCraftingRecipes.recipeCellBlock));
|
||||
dandelifeon.setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2"), new PageText("3"), new PageText("4"), new PageText("5"), new PageText("6"), new PageText("10"), new PageText("7"), new PagePetalRecipe("8", ModPetalRecipes.dandelifeonRecipe), new PageCraftingRecipe("9", ModCraftingRecipes.recipeCellBlock));
|
||||
|
||||
// DEVICES ENTRIES
|
||||
pylon = new BLexiconEntry(LibLexicon.DEVICE_PYLON, categoryDevices);
|
||||
|
||||
Reference in new issue
Block a user