You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1.21.1Targeted at Minecraft 1.21.11.21.2Targeted at Minecraft 1.21.21.21.3Targeted at Minecraft 1.21.31.21.4Targeted at Minecraft 1.21.4bugA bug or errorvanilla bugA bug or error in the base Minecraft game
Minecraft Version: 1.21.4 (valid to at least 1.20.1)
NeoForge Version: 21.4.75-beta
Steps to Reproduce:
Set a break point in GiveCommand around line 70
In game /give @s cobblestone 128 This should give the player 2 stacks of cobble, but notice that the "fake" entity is being initialized at the break point.
Because the construction, post of events, and handling of cancellations all happen before the entity is told it is fake, event consumers will misfire.
Description of issue:
Typical use of EntityJoinLevelEvent is to cut down on entity object churn when collecting items from say a mob farm. Canceling this event basically does just that; however, the give command creates "fake" entities when the player absorbs all of the command's items. We need a different way to either inform the consuming events that the entity is fake, or determine if the vanilla "fake item" for a single tick is a bug/feature.
The main issue from what I can see is that the ItemEntity sets all of its 'fake' settings after the entity has already been added to the world. If it was set beforehand, it would be relatively simple to just check if the pickupDelay is 32767, assuming that mods don't want call setNeverPickUp at any other point. Though it wouldn't be difficult to add another field that holds the true value in case that assumption is violated.
As for setting the fake item after being added to the world, I don't really see a reason why it couldn't be marked beforehand as the entity wouldn't be ticked before the method was called. The only reason I can see of why its set afterward is because its using the common ServerPlayer#createItemStackToDrop to construct the stack.
How to necessarily do such a thing is a point of contention. Capturing the 'fakeness' is possible if we use a ThreadLocal due to chunk load async. Another method would be to patch in a new drop method take contains a boolean on whether it's fake or not, though it's use case is only limited to the give command.
1.21.1Targeted at Minecraft 1.21.11.21.2Targeted at Minecraft 1.21.21.21.3Targeted at Minecraft 1.21.31.21.4Targeted at Minecraft 1.21.4bugA bug or errorvanilla bugA bug or error in the base Minecraft game
Minecraft Version: 1.21.4 (valid to at least 1.20.1)
NeoForge Version: 21.4.75-beta
Steps to Reproduce:
GiveCommand
around line 70/give @s cobblestone 128
This should give the player 2 stacks of cobble, but notice that the "fake" entity is being initialized at the break point.Description of issue:
Typical use of
EntityJoinLevelEvent
is to cut down on entity object churn when collecting items from say a mob farm. Canceling this event basically does just that; however, the give command creates "fake" entities when the player absorbs all of the command's items. We need a different way to either inform the consuming events that the entity is fake, or determine if the vanilla "fake item" for a single tick is a bug/feature.Reference for problem:
Soaryn/XyCraftTracker#81
The text was updated successfully, but these errors were encountered: