Herro! I was wondering if anybody knew how to create a thing like 'onItemRightClick', but with a different key (F in this case). I've registered the key but need to make it somewhat replace onItemRightClick and have a function (elseif) below it. Thanks!
You mean, you want to execute code in the block, when the player hits the f key, while looking at your block? When the player hits your key, you will need to "raytrace" to get the block that the player is looking at. Then check if the block is an instance of your block. If it is, call a new method that you will create yourself in your block class. You will likely need to do some packet handling for this.
You will need to make a key handler and a client->server packet. After that send a packet to the server if the key handler has received the F key. in the packet on the process of the packet (on server) check if pleyer has the desired item. If the player has it than call your function and respond to the client with a confirmation that it can call the function as well.
Rollback Post to RevisionRollBack
Not doing mc modding that much anymore because I am making a full blown game that does not have limitations that mc has. (rip Magiology for now)
I may come back if MC fixes it's rendering pipeline.
To put it in better words, because I've done what you've said already, I want to put a line of code in an item class that imitates 'onItemRightClick' but using a key which I've registered in my Key Handler and PreInit. Get it? Because I've stated it and I've gotten you and one other person who've mistook what I've said.
You need to learn how to do your own research, because any time you want to do something that "imitates" something in vanilla you can just look at the vanilla code for how to do it.
In this case, you should use Eclipse to look at the "call hierarchy" for the onItemRightClick() method. That will show you the code that invokes that method, and presumably that code can be copied into your key handler to fire a similar method.
1) create a method in item called something like onKeyPressF()
2) copy code similar to the code that invokes onItemRightClick() into your key handler and have that call the method you created in step #1.
That's it. Note that a custom packet may be needed because the vanilla code sends a vanilla packet that may not be suitable for your use.
Herro! I was wondering if anybody knew how to create a thing like 'onItemRightClick', but with a different key (F in this case). I've registered the key but need to make it somewhat replace onItemRightClick and have a function (elseif) below it. Thanks!
You mean, you want to execute code in the block, when the player hits the f key, while looking at your block? When the player hits your key, you will need to "raytrace" to get the block that the player is looking at. Then check if the block is an instance of your block. If it is, call a new method that you will create yourself in your block class. You will likely need to do some packet handling for this.
Farewell everyone o/
No, it's an item. E.g. When F is pressed, return item stack.
You will need to make a key handler and a client->server packet. After that send a packet to the server if the key handler has received the F key. in the packet on the process of the packet (on server) check if pleyer has the desired item. If the player has it than call your function and respond to the client with a confirmation that it can call the function as well.
Not doing mc modding that much anymore because I am making a full blown game that does not have limitations that mc has. (rip Magiology for now)
I may come back if MC fixes it's rendering pipeline.
To put it in better words, because I've done what you've said already, I want to put a line of code in an item class that imitates 'onItemRightClick' but using a key which I've registered in my Key Handler and PreInit. Get it? Because I've stated it and I've gotten you and one other person who've mistook what I've said.
You need to learn how to do your own research, because any time you want to do something that "imitates" something in vanilla you can just look at the vanilla code for how to do it.
In this case, you should use Eclipse to look at the "call hierarchy" for the onItemRightClick() method. That will show you the code that invokes that method, and presumably that code can be copied into your key handler to fire a similar method.
1) create a method in item called something like onKeyPressF()
2) copy code similar to the code that invokes onItemRightClick() into your key handler and have that call the method you created in step #1.
That's it. Note that a custom packet may be needed because the vanilla code sends a vanilla packet that may not be suitable for your use.
I have, ffs. I just was wondering what would replace the 'onItemRightClick'.I have no idea how to get to the "call hierarchy" Thanks.
EDIT: Thank you, internet. I found out how to do the Call Hierarchy part.