The first one, is retrieving the integrated server; which is the one that runs on the client for singleplayer worlds. A bukkit server doesn't have a integrated server, since it's a dedicated server and is not on the client.
The second one, needs more elaboration. It could be that you are getting the server instance before it's initialization.
Where are you trying to get the server instance? What are you trying to do with it?
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
You can't access the server instance from the logical client, that would be reaching across sides.
It's possible to do this in single player or as the LAN host, but you'll almost certainly break things if you do. In multiplayer, the logical client and logical server are running on two completely different machines.
If you want to communicate between the logical client and logical server, you need to use packets.
What are you actually trying to do?
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
You should be handling your keybindings in ClientTickEvent instead of InputEvent.KeyInputEvent. Make sure that TickEvent#phase is TickEvent.Phase.END. diesieben07 explains this here.
Calling PlayerControllerMP#processRightClickBlock on Minecraft#playerController on the client side should work on both the integrated and dedicated servers, though you should pass it EnumFacing.UP instead of DOWN as that's the face that the player would have clicked on to place the block below them.
You should never need to create your own instance of NetHandlerPlayServer. You should never use classes that belong to the logical server (e.g. NetHandlerPlayServer) from the logical client or vice versa, this is reaching across sides.
You can see a working example of a keybinding that tries to place the player's held block below them here.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
I've created a client-only mod with the key binding and it worked on both a Forge and Vanilla server. If it's not working on Bukkit, that's an issue with Bukkit and one I can't help you with.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
I am a beginner to develop a minecraft mode in 1.11.2.
I tested this code on server connection status(bukkit server)
why this codes return null?
which method should I use?
Korean Developer
Sorry, my english isn't good. XD
lol you used my stackoverflow answer.
The first one, is retrieving the integrated server; which is the one that runs on the client for singleplayer worlds. A bukkit server doesn't have a integrated server, since it's a dedicated server and is not on the client.
The second one, needs more elaboration. It could be that you are getting the server instance before it's initialization.
The third one, is probably the second one.
Where are you trying to get the server instance? What are you trying to do with it?
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
I getting server instance in KeyInput Listener and want get NetHandlerPlayServer instance
like this
but all of getting MinecraftServer instance method return null..
I want to know the right way.
Korean Developer
Sorry, my english isn't good. XD
You can't access the server instance from the logical client, that would be reaching across sides.
It's possible to do this in single player or as the LAN host, but you'll almost certainly break things if you do. In multiplayer, the logical client and logical server are running on two completely different machines.
You can read more on sides here.
If you want to communicate between the logical client and logical server, you need to use packets.
What are you actually trying to do?
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
My original plan is placing block mid-air(bottom of player) using player interact logic.
first i want test that placing block bottom of player.
Korean Developer
Sorry, my english isn't good. XD
You should be handling your keybindings in ClientTickEvent instead of InputEvent.KeyInputEvent. Make sure that TickEvent#phase is TickEvent.Phase.END. diesieben07 explains this here.
Calling PlayerControllerMP#processRightClickBlock on Minecraft#playerController on the client side should work on both the integrated and dedicated servers, though you should pass it EnumFacing.UP instead of DOWN as that's the face that the player would have clicked on to place the block below them.
You should never need to create your own instance of NetHandlerPlayServer. You should never use classes that belong to the logical server (e.g. NetHandlerPlayServer) from the logical client or vice versa, this is reaching across sides.
You can see a working example of a keybinding that tries to place the player's held block below them here.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Test Result
(tested in bukkit server)
Korean Developer
Sorry, my english isn't good. XD
Thanks for your code
but github code not work for me...
placed block change to air and consumed item stack is restored when slot clicked.
Korean Developer
Sorry, my english isn't good. XD
I've created a client-only mod with the key binding and it worked on both a Forge and Vanilla server. If it's not working on Bukkit, that's an issue with Bukkit and one I can't help you with.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.