Posted November 29, 201510 yr I have a block that has two BlockStates and I want to make it where using a pickaxe on one actually breaks the other one in a different position. I have been able to make everything work except the actual breaking texture. From what I've seen, it looks like this can be achieved, but it involves using PlayerInteractEvent, and I still don't fully understand how to correctly utilize events. Does anyone have an idea how I can make this happen? Check out my Mod: The RPCraft Toolkit!
November 29, 201510 yr Author So I tried making an Event Handler, put this in my init method: MinecraftForge.EVENT_BUS.register(new BlockLargeCrate.PlayerInteractEventHandler()); And here's the body: public static class PlayerInteractEventHandler { @SubscribeEvent public void onPlayerInteract(PlayerInteractEvent event) { System.out.println("caught Interaction"); if(event.action == PlayerInteractEvent.Action.LEFT_CLICK_BLOCK && event.world.getBlockState(event.pos).getBlock() == BlockCrate.blockLargeCrate) { System.out.println("caught Block"); BlockPos pos1 = ((BlockLargeCrate)BlockCrate.blockLargeCrate).findTileBlock(event.world, event.pos); if(pos1 != event.pos) { System.out.println("this works"); } } } } But nothing ever fires, I don't even see the first println. Really need help on this one. Check out my Mod: The RPCraft Toolkit!
November 29, 201510 yr Author Okay, I figured out the issue (was a problem with my entire eclipse environment). The event handler is working, woo! Now I just need to know what function to call on the other block to make it start/continue breaking. Check out my Mod: The RPCraft Toolkit!
November 30, 201510 yr Author World.sendBlockBreakProgress() looks like the function I need, but what can I reference to know what break progress the current block wshould have? Seriously, any help at all would be appreciated... Check out my Mod: The RPCraft Toolkit!
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.