Jump to content

[1.8] SOLVED: Charging 1 custom furnace updates amount in all custom furnaces.


Kander16

Recommended Posts

Hi,

 

If I charge 1 custom furnace with an Item (storing the item into the furnace), it will change the amount in every furnace of the same type.

Like you put 1 water bucket into the furnace, it will 'store' the water into the custom furnace. But this will also store the same amount of water into all the other furnaces of the same type.

 

Thanks for helping.

 

TileEntityBoiler:

 

http://pastebin.com/VkfqZEE9

 

GuiBoiler:

 

http://pastebin.com/z3TCiMzw

 

 

Creator of the Master Chef Mod and many more to come.

 

If I helped you, please click the 'thank you' button.

Link to comment
Share on other sites

Hi,

 

Hi, changing my code gives another problem. It seems that drawGuiContainerForegroundLayer only gets called when opening the gui.

Only closing and re-opening the gui updates the information processed by drawGuiContainerForegroundLayer.

When I make the variables (<water, heath>) static it does update the gui continously though.

Creator of the Master Chef Mod and many more to come.

 

If I helped you, please click the 'thank you' button.

Link to comment
Share on other sites

	@Override
public Packet getDescriptionPacket() {
    NBTTagCompound nbtTag = new NBTTagCompound();
    this.writeToNBT(nbtTag);
    return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbtTag);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
    readFromNBT(packet.func_148857_g());
}

 

Note, I don't know if any of the names have changed in 1.8, but you need those functions otherwise the client doesn't know jack about the variables you're trying to use.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Draco, stop recommending description packets for GUI things. They are not the right tool.

You want to do something like the furnace does, take a look at how ContainerFurnace gets the burn values to the client.

 

This is the first time someone has ever said I'm doing it wrong.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

In which case:

1) You still need to declare the getPacket onPacket methods

2) Including the information is not in itself bad

3) You only need to call markBlockForUpdate when something major changes.

 

The code I posted addresses 1 and 2 which are required, because otherwise a player will log in and experience a desync (client not matching server state) due to the machine being in the middle of a cycle and the client started at the top.

 

#3 I did not include.  You do not need, and should not call, markBlockForUpdate just because the entity ticked.  But there are cases where it will need to be called (inventory changing) but again, I did not include this call.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

In which case:

1) You still need to declare the getPacket onPacket methods

Err, no?

 

No?

Last I checked the base implementation for description packets were blank, because vanilla entities had custom packets and didn't need it.

 

With something like burn time this might very well be every tick.

 

No, not really.  The update function runs on both client and server, so the update tick will handle the update to burnTime.  The only thing that does need to get synched is anything that can happen that the client cannot be aware of which includes inventory modification.

 

Containers are per-player. At the beginning you would always send everything.

 

Sorry, the premise and conclusion here don't seem to be correlated, nor does it contradict my own statement of "you'd have to include the information in the description packet."

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.