Jump to content

Recommended Posts

Posted

I have an item that applies a passive effect to the player that's carrying it, and I can remove this effect when the item is dropped, but I can't seem to find a spot that will let me know that the item was removed from the player's inventory and placed into another object's inventory.

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.

Posted

I know 2 ways to check if an special Item is inside of the Players Inventory.

 

First way is from the item itself (onUpdate() function).

 

Second way is from an entityliving update handler. with that you should can scan the inventory of the player.

 

I think this shoud be what you are asking. If not explain it in more detail.

 

 

Posted

I want to know when it's NOT in the player's inventory.

 

And scanning every inventory of every player on a server ever tick is not a viable solution.

 

I only need the function called once (the frame that it leaves the player's inventory) but I need something.

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.

Posted

yeah that checking is not a solution. And what is when you add a varibale to a player has The item in the inventory and then the living handler search only at these players who have this variable. Would that be a way?

Posted

I'm not sure that's all that viable either, as these effects are unique (each has a separate UUID for the SharedMonsterAttribute system, so that they stack), so I need to remove exactly the one that was placed into the chest.

 

I'd have to add several flags to every player. :\  If they have any, then I need to loop through their entire inventory and verify each one.

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.

Posted

Whenever one of these items is added to a player's inventory, store its UUID in a Map in IExtendedEntityProperties or someplace. Then, either find a way to inject code (ASM?) or edit base classes so that the InventoryPlayer checks for your Item onInventoryChanged, decrStackSize etc. and before setting the itemstack to null, remove its UUID from the map. That's the only way I can think of that wouldn't require doing lots of checks every tick.  :-\

Posted

Moritz and I found a solution that works well enough:

 

onUpdate, if the player has an inventory open, remove effect.  So the effect is suppressed while they're looking in a chest.

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.

Posted

I got another problem for you. What happends when the player (standart keybinding) is Pressing Q? (Means drop a item in your hand)

 

It gets tossed into the world as an EntityItem, and because THAT receives updates, it's easy to go "oh, hey, I've been dropped.  Hey NBT, what was the player's entity ID?"

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.

Posted

You can also use the ItemTossEvent.

 

Because of the way my items are built, I'm already using the EntityItemUpdate function (as there are effects which use it) so tying into that isn't difficult and keeps everything inside my Item class.

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.

Posted
.  Putting items into item frames doesn't trigger any kind of function either!  And doing that doesn't require opening a GUI!

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.

Posted

That will be triggered before the block trigger the putItemin function^^"

 

Actually, it's not.  I checked.

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.

Posted

Well if it's triggered after, you could check if the block being right clicked on is an Item Frame (or were Item Frame entities?), and then get the stored item from its TileEntity.

 

But even if this works, you still have the problem that this is not very reliable. You might have missed other vanilla features or other mods could easily add other features that take an item from your inventory by right clicking on something.

Author of PneumaticCraft, MineChess, Minesweeper Mod and Sokoban Mod. Visit www.minemaarten.com to take a look at them.

Posted

I think the problem is how you are doing your effect on the item.

It is bringing a lot of stupid issues because of this.

 

Edit: You could use the EntityInteractEvent and check for EntityItemFrame.

Posted

Well if it's triggered after, you could check if the block being right clicked on is an Item Frame (or were Item Frame entities?), and then get the stored item from its TileEntity.

 

It's not triggered before OR after, none of the item's functions are called.

 

I think the problem is how you are doing your effect on the item.

It is bringing a lot of stupid issues because of this.

 

How would you make an item that gives the player bonus health while they are carrying it?

 

Edit: You could use the EntityInteractEvent and check for EntityItemFrame.

 

I am trying to do this without events, but if I have to for this case I will.

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.

Posted

Hi.

 

Just a suggestion - if it's too expensive to check the inventory every tick, why not check (say) every 20 ticks.  A delay of 1 second will probably be unnoticeable to the player I imagine, depending on what "effect" you are applying.  Even if it is noticeable, perhaps you can turn it into a feature (eg - "the unholy aura effect lasts for 10 seconds after you throw away the skull of putrescence", or similar).

 

And to be honest I doubt it really takes that much extra time to check a player's inventory slots for a particular item ID.  You could try it with a profiler and see if it is a significant slowdown or not.

 

All the other solutions sound a bit fragile to me.

 

Cheers

  TGG

 

Posted
And to be honest I doubt it really takes that much extra time to check a player's inventory slots for a particular item ID

 

And then read that item's NBT data. :|

This isn't "oh, Item ID 1322 increases your health" it "Item ID 1322 {["onOwned":"increaseHealth"}]" vs. "Item ID 1322 {["onOwned":"increaseSpeed"}]" vs. "Item ID 1322 {["onUpdate":"heal1"}]" vs. "Item ID 1322 {["onRightClick":"causeLightning"}]" vs....

 

Anyway, if we're going to call things features, I think it would be a more interesting "feature" that items in frames are permanent boosts. :P

It's like a litch's phylactery!

 

It just isn't meaningful in SSP: no one can try and sneak into your base and "destroy" your powerbase.

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.

Posted

Now there's an idea for a mod :)

 

You mean the one I'm working on?

 

At last check I have over 67 million different items which may or may not have enchantments.

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.

Posted

Lol draco, I'm giving you cred++; just for the signature you have on MCF there, nice one :)

 

My signature arose from the fact that I tried to kindly remind someone that they shouldn't post in mod threads about updates.  I was all "hey, I just found out myself, but your post is technically against the TOS, didn't want to get you in trouble, just thought I'd let you know."

Someone decided I was being a total asshat.

Flames ensued.

 

I ended up reporting my own post to the mods for calling myself an asshole.

 

So I created my signature in an effort to deter such events in the future.

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.

Posted

Did you solve the problem with the itemframe alread? If not there should be a function which is called onInteractWithEntity(ItemStack par1, EntityPlayer player, EntityLivingBase par3)

{}

 

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I need to know what mod is doing this crash, i mean the mod xenon is doing the crash but i want to know who mod is incompatible with xenon, but please i need to know a solution if i need to replace xenon, i cant use optifine anymore and all the other mods i tried(sodium, lithium, vulkan, etc) doesn't work, it crash the game.
    • I have been trying to solve a consistent crashing issue on my brother's computer where it will crash during the "Scanning Mod Candidates" phase of the loading process that starts when you click the play button on the Minecraft launcher. The issue seems to stem from a missing library that it mentions in the log file I provide below. I might I'm missing the bigger issue here for a smaller one but hopefully someone can find what I'm missing. Here's all of the stuff that I've been able to figure out so far: 1. It has nothing to do with mods, the crash happened with a real modpack, and even when I made a custom modpack and launched it without putting ANY mods into it (That is where the log file comes from by the way). 2. I have tried to find this class like a file in the Minecraft folders, but I've had no luck finding it (I don't think it works like that, but since I really don't understand how it works, I just figured I'd try). 3. I haven't seen anyone else have this issue before. 4. I know that my modpack (with mods) does work since I've run it on my computer, and it works fantastic. For some reason my brother's computer can't seem to run anything through curseforge. 5. This is for Minecraft version 1.20.1, Minecraft launcher version 3.4.50-2.1.3, forge 47.3.0, and curseforge app version 1.256.0.21056 6. My brother is using a Dell laptop from 6 years ago running Windows 10 (If you think more info on this would help, please ask as I do have it. I'm just choosing not to put it here for now). 7. I have reinstalled the curseforge app and installed Minecraft version 1.20.1. I have not reinstalled Minecraft or forge 47.3.0 but I didn't know if that would help. 8. I had an error code of 1 Please let me know if there is anything else that I am missing that you would like me to add to this post/add in a comment! Lastly, many thanks in advance to whoever can help! ------------- LOG FILE (latest.log) ------------- (from /Users/<NAME OF USER>/cursforge/minecraft/Instances/<THE NAME OF MY EMPTY MODPACK>/logs/latest.log) (This was made after running an empty modpack with same versions for all apps) ("[REDACTED]" is not the actual text from the log, it is me replacing text I figured wouldn't be necessary for fixing and would hurt my privacy) https://pastebin.com/hxXvGGEK ------------- DEBUG.LOG (I realized that I should have put this here first after I had done all of the work on putting latest.log in) -------------------- (again, "[REDACTED]" is not the actual text from the log, it is me replacing text I figured wouldn't be necessary for fixing and would hurt my privacy) https://pastebin.com/Fmh8GHYs
    • Pastebin... https://pastebin.com/Y3iZ85L5   Brand new profile, does not point to a mod as far as I can tell, my fatal message just has something about mixins. Don't know much about reading logs like this, but am genuinely stuck, please help. Java updated, pc restarted.
    • I was playing minecraft, forge 47.3.0 and 1.20.1, but when i tried to play minecraft now only crashes, i need help please. here is the crash report: https://securelogger.net/files/e6640a4f-9ed0-4acc-8d06-2e500c77aaaf.txt
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

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