Posted February 4, 20178 yr Hello all. I'm trying to find a way to tell if the player broke a block client-side - any block at all. I've tried using BlockEvents.BreakEvent but that appears to be server-side only... (isRemote only returns false, never true) It's for rendering stuff, so I really don't want to send packets every time the player breaks a block... has anyone got any ideas?
February 4, 20178 yr Author I wanted to draw some particles (but I don't understand why this matters?)
February 5, 20178 yr Author Thanks, I got it working now: public void playEvent(EntityPlayer player, int code, BlockPos pos, int blockId) { EntityPlayerSP realPlayer = Minecraft.getMinecraft().thePlayer; if (code == 2001 && player == null && realPlayer != null && realPlayer.getDistanceSq(pos) < 46 && realPlayer.rayTrace(4.5, 0).getBlockPos().equals(pos) && realPlayer.isSwingInProgress) { // 50 == 5 blocks (max. 4) this.blockBroken = true; } } Edited February 5, 20178 yr by 315Lukas Code improvements
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.