- 271
- 2
- 0
Значит он должен при определенных условиях ставить блоки. В методе "updateEntity()" я чекаю условия и в определенном мире ставит блок. Но блоки фантомные(не сохраняются,исчезаю при пкм и т.д.). Я пробовал убрать проверку на мир, получать "World" через "Minecraft.getMinecraft().theWorld" (пробовал и "tile.getWorldObj()") но увы, результат не менялся.
public class TileEntityForBlockWithTE extends TileEntity{ // да да название найс
public int progress = 0;
public int bl = 0;
public TileEntityForBlockWithTE(){
System.out.println("PLACE");
}
@Override
public void updateEntity() {
super.updateEntity();
//if(this.getWorldObj().isRemote){
this.progress++;
if(this.progress >=100){
Minecraft.getMinecraft().theWorld.setBlock(this.xCoord, this.yCoord+1, this.zCoord+this.bl, Blocks.gold_block);
this.getWorldObj().setBlock(this.xCoord, this.yCoord+1, this.zCoord+this.bl-1, Blocks.air);
this.progress = 0;
this.bl++;
if(this.bl >= 5)this.bl=0;
}
//}
}
public void writeToNBT(NBTTagCompound nbt)
{
super.writeToNBT(nbt);
nbt.setInteger("progress", this.progress);
nbt.setInteger("bl", this.bl);
}
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT(nbt);
this.progress = nbt.getInteger("progress");
this.bl = nbt.getInteger("bl");
}
}