Posted October 31, 201311 yr I have been fiddling with code all day and have not found a single peice of code that works.. But lets say this. I press my LeftMouseButton. that button initiates a method and that method slowly damages the block based on my pickaxe and the BlockID. I no longer need to mine at a specific x,y,z but what is this damn method?! I've searched for two days now. I've tried PlayerControllerMP.clickBlock() World.destroyBlock(), World.partiallyDestroyBlock(), etc.. Basically what i am saying is this. What method tells the game (Client AND Server). that i am mining/breaking/have broken the block im looking at?
October 31, 201311 yr Why are you going to hurt the computer? It's a tool. It's like punching a hammer because you can't figure out how to make it pound a nail into a board. Jokes aside, you're looking at the wrong side of things. This is done with packets.... specifically the Packet14DigBlock.class packet which is then handled by the netserverhandler regardless of which side you are on. So it is always dealt with on the server side, be it dedicated or integrated, applied to the server world, and then sent as a packet for the actual update (block removal generally). If you want more deatil look into the NetServerHandler.class I think its my java of the variables.
October 31, 201311 yr Hi The client tells the server to dig the block, the server handles the digging and destroys the block (and sends the results back to the client). The client uses packet14 http://greyminecraftcoder.blogspot.com.au/2013/10/packets-from-client-to-server.html This is handled by NetServerHandler.handleBlockDig The methods in ItemInWorldManager are used to do the block harvesting and item damage In particular ItemInWorldManager.tryHarvestBlock This sets a flag in WorldServer.setBlock which causes the server to (a bit later) send the new block information to the client (markBlockFOrUpdate) -TGG
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.