Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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!

  • 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!

  • 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!

  • 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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.