Jump to content

Recommended Posts

Posted

Hi,

 

I'm looking to replace the vanilla which is placed by bucket in my custom dimension. So I first looked how vanilla does with the water in the nether and they do by a method in ItemBucket which I obviously can't edit. So I looked at Forge events for some answers and I came across the PlayerInterectEvent so this is what I've came up. I've just tried cancelling the interaction at first but it doesn't seem to work. But it gets called and If I try it with a torch it gets cancelled so Im not sure what Im doing wrong here.

 

Heres the code:

 

@SubscribeEvent
public void playerInteract(PlayerInteractEvent event)
{
	ItemStack hand = event.entityPlayer.inventory.getCurrentItem();
	if(event.entityPlayer != null && hand != null)
	{	
		if(event.entityPlayer.dimension == 3 && hand.getItem() == Items.water_bucket)
		{
			if(event.action == event.action.RIGHT_CLICK_BLOCK)
			{
				System.out.println("call");
				event.useItem = Result.DENY;
				event.setCanceled(true);
				//event.world.setBlock(event.x, event.y, event.z, ACBlocks.frostWaterIce);
			}
		}
	}
}

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.