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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

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