I'm finishing up my mod, so I made everything for the Server Side portion of the game, and it seems like I can't use my custom set Keybinding to control a function I added for my new block. Here is the issue,
The server source files does not include the GameSettings class, and I need to be able to call this class to activate the feature I have implemented. How could I call a class that's a part of the client source, and not the server source?
Anyone who provides actual help that leads to fixing this issue will get credit in my mod.
Sorry if this is vague, but it should give a rough idea.
GameSettings is client side, add that code to the client source, and send a packet to the server from the client source which will execute the code? something like that?
Here, I gave help to this guy and I included packet sending, just adapt and use.
Sorry if this is vague, but it should give a rough idea.
GameSettings is client side, add that code to the client source, and send a packet to the server from the client source which will execute the code? something like that?
Here, I gave help to this guy and I included packet sending, just adapt and use.
Yeah, it looks like the code you gave to him is only for Forge, and not Vanilla Minecraft. I can't use it if it is, so if it is please pay more attention when to the post when you reply. :/
If it will work with Vanilla, you're probably going to explain how, or show a reference. I can't find anything for this.
EntityClientPlayerMP -> NetClientHandler -> NetServerHandler -> EntityPlayerMP
You just need a new instance of packet to send, then handle it on server side.
Vanilla sneaking also make use of DataWatcher, which send back from server to client (for animation purposes).
Minecraft.getMinecraft().thePlayer.sendQueue #an instance of NetClientHandler
NetClientHandler.addToSendQueue(packet) #the way to send packet
NetServerHandler.processXYZ(packet) #the way it handles the packet
DataWatcher is defined in Entity. You can use it in any child classes.
It seems like the DataWatcher would be best for the keybinding setup I have planned to extend the features of Orientation Based blocks...
I still don't understand how this works, there's so many implementations it's a little overwhelming at the moment to look at.
protected DataWatcher dataWatcher;
/**
* Returns true if the flag is active for the entity. Known flags: 0) piston; 1) dispenser;
*/
protected boolean getFlag(int par1)
{
return (this.dataWatcher.getWatchableObjectByte(0) & 1 << par1) != 0;
}
/**
* Returns if this the reverse key is pressed.
*/
public boolean reversePiston()
{
return this.getFlag(0);
}
/**
* Returns if this the reverse key is pressed.
*/
public boolean reverseDispencer()
{
return this.getFlag(1);
}
Would I do it like this? I only have 1 keybind set, and I am not sure if I see where keyBindSneak is added to where it's implemented into packet information. The only thing I see that it might be is either in the MovementInputFromOptions class
As i said, DataWatcher is only going to send from server to client.
You want a packet from client to server.
Sneak/Jump packet is called C0BPacketEntityAction in 1.7. Not sure what name it had in 1.6.
You will be able to tell just by looking in NetServerHandler when playerEntity.setSneaking(boolean) is called.
Or in EntityClientPlayerMP#sendMotionUpdates()
So the client side NetServerHandler sends packets to the server side NetServerHandler or what?
If so then I would do something like this, right?
Keybind returns true/false > client NetServerHandler returns true/false > server NetClientHandler returns true/false to server side custom block > server side custom block inverts orientation
I'm finishing up my mod, so I made everything for the Server Side portion of the game, and it seems like I can't use my custom set Keybinding to control a function I added for my new block. Here is the issue,
KeyBinding var8 = GameSettings.keyReversePlacement;
The server source files does not include the GameSettings class, and I need to be able to call this class to activate the feature I have implemented. How could I call a class that's a part of the client source, and not the server source?
Anyone who provides actual help that leads to fixing this issue will get credit in my mod.
GameSettings is client side, add that code to the client source, and send a packet to the server from the client source which will execute the code? something like that?
Here, I gave help to this guy and I included packet sending, just adapt and use.
http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2275314-gui-button-help
See the player "jump"/"sneak" keybind and NetServerHandler for how vanilla does it.
if (var4)
{
GameSettings var5 = this.mc.gameSettings;
this.mc.ingameGUI.func_110326_a(I18n.getStringParams("mount.onboard", new Object[] {GameSettings.getKeyDisplayString(var5.keyBindSneak.keyCode)}), false);
}
Other than that, I don't know. I don't find much else.
#Edit: That code is for the dismounting of entities.
Yeah, it looks like the code you gave to him is only for Forge, and not Vanilla Minecraft. I can't use it if it is, so if it is please pay more attention when to the post when you reply. :/
If it will work with Vanilla, you're probably going to explain how, or show a reference. I can't find anything for this.
@GotoLink
Either of you care to elaborate?
EntityClientPlayerMP -> NetClientHandler -> NetServerHandler -> EntityPlayerMP
You just need a new instance of packet to send, then handle it on server side.
Vanilla sneaking also make use of DataWatcher, which send back from server to client (for animation purposes).
I've been looking into this, I can't seem to figure out what you're meaning, or where it's defined and stuff like that.
There are 531 matches when I search DataWatcher, do you know where that is defined?
NetClientHandler.addToSendQueue(packet) #the way to send packet
NetServerHandler.processXYZ(packet) #the way it handles the packet
DataWatcher is defined in Entity. You can use it in any child classes.
I still don't understand how this works, there's so many implementations it's a little overwhelming at the moment to look at.
Would I do it like this? I only have 1 keybind set, and I am not sure if I see where keyBindSneak is added to where it's implemented into packet information. The only thing I see that it might be is either in the MovementInputFromOptions class
You want a packet from client to server.
Sneak/Jump packet is called C0BPacketEntityAction in 1.7. Not sure what name it had in 1.6.
You will be able to tell just by looking in NetServerHandler when playerEntity.setSneaking(boolean) is called.
Or in EntityClientPlayerMP#sendMotionUpdates()
What I got is this.
I see that the Packet19EntityAction is taking the information from this, and I think using it in the Packet class, but I get lost after that.
If so then I would do something like this, right?
Keybind returns true/false > client NetServerHandler returns true/false > server NetClientHandler returns true/false to server side custom block > server side custom block inverts orientation
???