xsun2001 / Applied-Energistics-2-Unofficial

Unofficial AE2 for 1.7.10 which is still supported,which is like the extraterrestrial technology.
Other
28 stars 13 forks source link

Add a Interact on wrench/right click #6

Closed Eufranio closed 7 years ago

Eufranio commented 7 years ago

ATM AE2 just sends some packets from the client to the server know that it clicked something, so there is no way to listen for those packets. I suggest you adding a interact when a player uses a wrench in a AE2 block (and check if it's not cancelled), and also when right clicking AE2 blocks (such as terminals).

xsun2001 commented 7 years ago

I do not really understand what is the meaning of "interact" because of my poor English, althrough there is some online translater. Did you mean we should send packets that contains the information of what I clicked or something else?

Eufranio commented 7 years ago

Interact is the event fired when someone right/left click something, collide with a pressure plate, jump, walk over specific blocks, etc. They are called "interactions", see: http://www.minecraftforge.net/forum/topic/25346-right-click-event-that-triggers-after-block-interaction/

My suggestion is that when someone right click anything from a network, BEFORE the original logic be made, include a PlayerInteractEvent. This event can be cancelled by the bukkit or forge side, meaning that bukkit plugins and forge mods can track the right clicked blocks.

As this page says, you can add a PlayerInteractEvent every time a AE2 blocks is clicked. Then, check if it is cancelled (event.isCancelled()), and if it is not cancelled, run the rest of the logic (such as permission checks by the security station, etc).

xsun2001 commented 7 years ago

I have added 'PlayerInteractEvent' for ME network parts and 'PlayerUseItemEvent.Start' for some items which will do something special when right click. @Eufranio If you think it is good enough, you can close it youself, or you can ask me for the further improve.

Eufranio commented 7 years ago

That's good, thanks!