Skip to content
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

Fix IllegalArgumentException: Cannot copy null stack in ItemStackMixin_NeoForge #1550

Merged
merged 7 commits into from
Nov 16, 2024

Conversation

LabsZero
Copy link
Contributor

@LabsZero LabsZero commented Nov 13, 2024

Fixes IllegalArgumentException: Cannot copy null stack reported in server logs.

…n_NeoForge

Fixes IllegalArgumentException: Cannot copy null stack reported in server logs.
@LabsZero LabsZero changed the title Fix IllegalArgumentException: Cannot copy null stack in ItemStackMixi… Fix IllegalArgumentException: Cannot copy null stack in ItemStackMixin_NeoForge Nov 13, 2024
@@ -64,7 +69,7 @@ public abstract class ItemStackMixin_NeoForge implements ItemStackBridge, IItemS
}

@Deprecated
public void setItem(Item item) {
public void setItem(@Nullable Item item) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I know, there shouldn't be an ItemStack with a null item, it should be Items.AIR instead.

private int arclight$itemDamage(ServerLevel serverLevel, ItemStack itemStack, int i, @Local(ordinal = 0) LivingEntity damager) throws Throwable {
// Added null check for itemStack
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind figuring out which method passed a null as ItemStack into this method?
In Minecraft modding, these should all be replaced by ItemStack,EMPTY. If it happened in NeoForge, perhaps it was their bug.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure i will look into it asap

@qyl27 qyl27 self-assigned this Nov 14, 2024
@LabsZero
Copy link
Contributor Author

LabsZero commented Nov 16, 2024

ignore my last pull request still looking into the matter.

@LabsZero LabsZero closed this Nov 16, 2024
@LabsZero LabsZero reopened this Nov 16, 2024
Copy link
Contributor Author

@LabsZero LabsZero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully this fixes the null issue. If it needs more than happy to work on it further.

@qyl27
Copy link
Collaborator

qyl27 commented Nov 16, 2024

Although I am still confused as to why the this of ItemStack will be null, thanks for your PR, I'll merge it.

@qyl27 qyl27 merged commit 17f1124 into IzzelAliz:FeudalKings Nov 16, 2024
1 check passed
@qyl27
Copy link
Collaborator

qyl27 commented Nov 17, 2024

I think the root problem is in


And I have solved it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants