Jump to content

Write in a sign from a forge mod


McPqndq

Recommended Posts

Hello,

 

I'm currently making a mod for game automation, and I would need the mod to automaticly write something on a sign.

I tried to simulate keyboard keys using the java Robot class, but it only send keys to the current active window, and not to the game, if it's not active...

I was wondering if there is a "forge" way to write something in a sign.

 

Is it possible ?

Ty

Link to comment
Share on other sites

Signs have tile entities that store their text. You can access it that way.

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

Thank you for your answer, but how am I supposed to do that ?

 

Is it the correct way to get the sign's tile entity ? :

TileEntitySign tileEntitySign = (TileEntitySign) Minecraft.getMinecraft().world.getTileEntity(new BlockPos(0, 0, 0));

 

Link to comment
Share on other sites

13 minutes ago, McPqndq said:

Minecraft.getMinecraft().world

This is client side only.

Either:

  • Your mod needs to be client side only (in which case, it can't make changes).
  • You need to access the TE via a server world.

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

19 minutes ago, McPqndq said:

You mean that if the mod is client side only, it's not possible ? My mod is client side only

You could read the text of the sign, but you can't change it, because of this pesky thing called "server authoritative model."

That is, the server is the absolute authority on the state of the game, and that state includes the text on signs. Without code on the server to change that text, you can't.

Edited by Draco18s

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

Vanilla has code to handle that, but that doesn't mean you can hook into it and make it do what you want.

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

  • Guest locked this topic
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.