Jump to content

[1.8]Translating breaking to another Block


GalianRyu

Recommended Posts

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!

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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