Jump to content

Updating a sign both client & server


smokyb00

Recommended Posts

Hi there!

ย 

I'm currently working on a mod and am having a bit of trouble with something. I'm adding the ability for signs to be edited just by right clicking (in the future I'll be using a specific item with right click to edit, but this doesn't matter). I've got the function to open the GUI sign editor and I can edit the sign fine in singleplayer. The problem is, on my multiplayer server, when I right click and edit the sign, the sign goes back to its original value. Is there a way to fix this? Would I have to have a mod on the server to handle this or is there a way to just take care of this only on the client.

I've looked around all over the place, but can't seem to find anything about this

Appreciate some guidance, cheers :)

Link to comment
Share on other sites

13 minutes ago, diesieben07 said:

Signs cannot be updated once they are placed. You have to specifically allow it server side. So yes, you need a server portion of the mod.

Huh I see, so would it be best to create the sign myself then with text preset?

Link to comment
Share on other sites

7 minutes ago, diesieben07 said:

Not sure what you mean by this exactly. What I mean is that you cannot do this with a purely client side mod. A server side mod can obviously edit the sign.

Yeah I understand that. Disregarding editing the sign, since I'd have to do stuff on the server side, could I instead just create a sign and assign text to it?

I'm basically trying to have sign templates. At this point, I'd want it to work in the sense a player has a sign in their hand, if they place the sign, it'll automatically set the text that way. Would this work since it's creating and not editing?

Link to comment
Share on other sites

6 minutes ago, diesieben07 said:

I guess you could do that client-side, yes. You'd have to detect the sign editing GUI popping up and then send out the packet that is sent when the player finishes setting the text.

Ah cool, sounds like it would work. Apologies for the follow-up question, but how would one detect the sign editing GUI popping up? I know there's currentScreen but not sure if that's applicable in this case, just skimming through some examples online of that usage

ย 

Edited by smokyb00
Link to comment
Share on other sites

17 minutes ago, Luis_ST said:

yes, if you check before whether the Gui is an instance of GuiEditSign

Yeah sorry that's what I meant by detecting the Edit GUI sign, doing an if instanceof statement. I don't understand how the text would be set though, would I just replicate a Keyboard judging by the GuiEditSign class? I know with a tile sign, you have signText or something along those lines, but I guess with the GUI, it's a bit different?

Link to comment
Share on other sites

4 minutes ago, diesieben07 said:

GuiEditSign is not a class. What version are you using?

Sorry should have stated this from before, using 1.12.2 - going to be doing this on the latest version but just modifying an old mod of mine to understand this before upgrading my mod completely

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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