Jump to content

[1.10.2] item leaves inventory


Zerahi

Recommended Posts

I have an activated item that gives a buff, i got it to take the buff off if it leaves your action bar, and if you drop it. My only problem is it a player puts it in an inventory like a chest nothing gets called that i can see, any method for that i'm missing? Or should  i just stick to short duration buffs so they fall off it its not maintained.

 

onUpdate stops calling on leave but that also means i cant turn it off with that and onDroppedByPlayer doesn't call unless its spawns in world

Link to comment
Share on other sites

You could do too things I just thought of

1. Subscribe to playerTickEvent and use that

2. Check if player.openContainer != null then remove the buff

I prefer the second option.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

yeah but then like an item frame could be used to get around it too. and i have a charging stand that just right click with no inventory, just takes it from you hand and copy it, the upkeep tick also charges the item so its not like its not running anyway just seeing if their was a better way

Link to comment
Share on other sites

Then you could subscribe to the PlayerInteractEvent and set the buff a lot less lag intensive though it requires more code.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Good luck covering every possible way it can leave your inventory.

(Hint: itemframes)

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

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.

×
×
  • Create New...

Important Information

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