-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
/give will give twice if the item hasCustomEntity #2349
Comments
I'm not sure there is a way to fix this, if anyone has any ideas let me know. |
The only possible way I see to fix this so far is to force Item.createEntity to return an EntityItem (but that of course requires breaking mods which use that method), the next best thing is to detect if the result from createEntity is an instance of EntityItem and handle it if it is (that seems better then nothing), and otherwise ignore it (unless that's what already happens, in which case I was useless). Another thing you could do is deprecate createEntity and ask for something like createEntityItem instead, but that's more of a workaround (sorry for stating the obvious) |
Sadly the only real way to do it is to capture all entities added to world in this event. |
There is still the "useful" case of having a full inventory. When that happens, I don't know the disadvantages of restricting to EntityItem (is there any example?), but it seems like the correct way. |
After sleeping on the issue I think I agree with lex, the easiest solution is to check for custom entity and prevent the item spawning. |
The 'real value' is fine, and honestly would work just fine the entity just lands on the ground and if its custom use the custom mechanic to pick it up. That part i'm not worried about it's the stupid visual one that I am. |
This issue has been automatically marked as stale because it has not had activity in a long time, and will be closed if no further activity occurs. If this issue was overlooked, forgotten, or should remain open for any other reason, please reply here to call attention to it and remove the stale status. Thank you for your contributions. |
Tested in 1.12 and this still happens with items that have a custom entity item like tinker's tools. Github image upload isn't working for me today so here's a linked screenshot instead: |
This issue has been automatically marked as stale because it has not had activity in a long time. If this issue is still relevant and should remain open, please reply with a short explanation (e.g. "I have checked the code and this issue is still relevant because ___." or "Here's a screenshot of this issue on the latest version"). Thank you for your contributions! |
Lex, any thoughts on if we can fix this in 1.13? |
This issue has been automatically marked as stale because it has not had activity in a long time. If this issue is still relevant and should remain open, please reply with a short explanation (e.g. "I have checked the code and this issue is still relevant because ___." or "Here's a screenshot of this issue on the latest version"). Thank you for your contributions! |
This doesn't appear to be an issue in 1.13 |
Hello I propose a solution to the problem of the double item give during the give command, it may not be suitable for everyone but it works: I invoke the object on the reader and there are no duplicates to make it appear on a player, I can do: /execute {player} ~ ~ ~ summon Item ~ ~1 ~ {Item:{id:"tconstruct:shuriken",Count:1,tag:{display:{Name:"§fShuriken epineux"},StatsOriginal:{AttackSpeedMultiplier:1.0f,... I hope I was able to help you |
This was fixed 4 years ago. |
Maybe in the new version but not in 1.12.2 for example |
We stopped developing 1.12 many, many, many years ago. |
The expected behavior:
CommandGive.processCommand
will add an item to the player's inventory, and also spawn an item.The problem:
The item entity that CommandGive has is not the same one that is spawned if the item
hasCustomEntity
.This is because
entityplayer.dropPlayerItemWithRandomChoice
returns the regular EntityItem instead of the custom one that is actually spawned.CommandGive sets the special properties on the wrong item entity, so the custom entity that is spawned hangs around like a regular dropped item.
After trying to PR:
I think this is not simple to fix because
Item.createEntity
returns an Entity, and all the relevant methods require an EntityItem.The text was updated successfully, but these errors were encountered: