1

Code

JimboPanda123's Avatar JimboPanda1233/17/15 1:36 pm
1 emeralds 329 3
3/19/2015 9:13 am
SomeonePrivate's Avatar SomeonePrivate
Hi,
I was starting to make a mod and i want the code so when a certain block is clicked with a certain item, you get a new item.
What would be the code for this?

Thanks
Posted by JimboPanda123's Avatar
JimboPanda123
Level 41 : Master Enderdragon
21

Create an account or sign in to comment.

3

1
03/19/2015 7:06 am
Level 88 : Elite Senpai
sekwah41
sekwah41's Avatar
If youve coded the block yourself or the item yourself use the interaction method which is called in their code. I forget what their names are but I think its onInteract in the block.

If its in the block check the item the player is holding and if its the item get the block.

If your using both a vanilla item and block then it will only work with the event like L4BORG suggested and you will have to check both.

I personally used the event for bone meal on a custom sapling I made.
1
03/17/2015 1:52 pm
Level 1 : New Miner
L4BORG
L4BORG's Avatar
You should implement Listener and then check in PlayerInteractEntityEvent(PlayerInteractEntityEvent playerInteractEntityEvent) which block was clicked and by who.
1
03/19/2015 9:13 am
Level 9 : Apprentice Explorer
SomeonePrivate
SomeonePrivate's Avatar
Block is not an entity, it is PlayerInteractEvent and then get the action right click block
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome