Hello,
I am making a "multiblock" structure that requires 3 blocks one of top of the other to make it full, if it full it changes a variable called fullPole to true
I aint sure why, i change the variable when the last block is placed, but when i try to read it from other class it doesnt work.
public class TileEntityShowerPole extends TileEntity
{
public boolean fullPole;
public void readFromNBT(NBTTagCompound nbtdata)
{
super.readFromNBT(nbtdata);
this.fullPole = nbtdata.getBoolean("fullPole");
}
public void writeToNBT(NBTTagCompound nbtdata)
{
super.writeToNBT(nbtdata);
nbtdata.setBoolean("fullPole", this.fullPole);
}
public TileEntityShowerPole()
{
fullPole=false;
}
public void TestFullPole(World world,int x,int y,int z)
{
if (world.getBlock(x, y-1, z) == OthersMod.showerPole)
{
if (world.getBlock(x, y-2, z) == OthersMod.showerPole)
{
fullPole=true;
return;
}
}
fullPole=false;
}
}
When i try to read it like
@Override
public boolean canPlaceBlockAt(World world, int x, int y, int z)
{
TileEntityShowerPole tileEntityShowerPole = (TileEntityShowerPole)world.getTileEntity(x, y, z-1);
if (tileEntityShowerPole!=null)
System.out.println(tileEntityShowerPole.fullPole);
}
i always get false. when i right click the block
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_)
{
if(!world.isRemote){
TileEntityShowerPole tileEntityShowerPole = (TileEntityShowerPole)world.getTileEntity(x, y, z);
if (tileEntityShowerPole!=null)
System.out.println(tileEntityShowerPole.fullPole);
}
return true;
}
i get true.
i am running the TestFullPole on the ShowerPole onBlockAdded
Someone know what i am doing wrong?
Edit: The z-1 thing on can place is intentional, after printing the coordinates its the exact same.