• 1

    posted a message on Creating Custom Furnace Crash On Right Clicking Block
    This code, TileEntityPyrolysisChamber tileEntityPyrChamber = (TileEntityPyrolysisChamber) world.getTileEntity(x, y, z); in what class is it? (if it was on any gui related class, your code is probably calling the tileentity on the client side, that hasn't updated yet, it will go away once you set it up whit the packets and make a null check just to bee save)

    The 2 methods go in to your tileentity and you call it when the referred tileentity needs an update, like:

    public void updateEntity(){

    boolean wasupdated=false;

    ... do stuff and set the test...

    if (wasupdated=true){

    worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
    markDirty();

    }
    }
    Posted in: Modification Development
  • 1

    posted a message on Creating Custom Furnace Crash On Right Clicking Block
    Hey, the client tile entity and the server one are separated, you need to update the client one, has the gui only takes what is on the client side, you can make so your code updates the 2 of then (like if(world.isRemote) for the client and if(!world.isRemote) for the server), or you can send packets to the client, but for that you need to have a working saving a reading from the ntb and the package methods. The 2 methods below send all the data saved on ntb on the server to the client:

    public Packet getDescriptionPacket() {
    NBTTagCompound nbtTag = new NBTTagCompound(); //create a new ntb tag
    this.writeToNBT(nbtTag); //save call the wirite method on the new nbttag
    return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbtTag); //create and send the packet
    }

    public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
    readFromNBT(packet.func_148857_g()); // call the read method on the packet recived
    }

    and this lines make the block update and send the package:

    worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); // Makes the server call getDescriptionPacke
    markDirty();

    sending packets may slow it down a little so make sure that you only send when it is necessary or edit the methods to only send what you need.
    Posted in: Modification Development
  • To post a comment, please .