Posted April 4, 20187 yr Hello Internet, I want to ask you, how i can simulate a rightclick clientside, to let the player place a block. Thank you for any kind of help!
April 5, 20187 yr Yes, send the packet for the key binding associated to the right click. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
April 5, 20187 yr Author I found a solution: public static void placeBlock() { Minecraft mc = Minecraft.getMinecraft(); EntityPlayerSP player = mc.thePlayer; if(player != null && player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemBlock && mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == MovingObjectType.BLOCK) { mc.playerController.func_178890_a(player, mc.theWorld, player.getHeldItem(), mc.objectMouseOver.getBlockPos(), mc.objectMouseOver.sideHit, mc.objectMouseOver.hitVec); player.swingItem(); } }
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.