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

Attempt to get block drops from MI barrel/tank without attached block entity can crash the game #931

Open
James103 opened this issue Nov 20, 2024 · 2 comments

Comments

@James103
Copy link

When an MI barrel or tank is broken or its drops are otherwise retrieved, the mod checks if the block entity, which holds the content of the barrel, is empty or locked when determining whether to copy the block entity data into the barrel to be dropped.
However, mods like Building Gadgets 2 can call the function to get the item which drops from breaking the barrel without the barrel having an attached block entity. This breaks these mods' functionality, which can cause errors or even crash the game.
Original issue: Direwolf20-MC/BuildingGadgets2#143

public ItemStack getCloneItemStack(LevelReader world, BlockPos pos, BlockState state) {
return getStack(world.getBlockEntity(pos));
}

Fixing this will likely need a check to see if the block's block entity is null, and if so returns an empty barrel/tank/appropriate storage unit.

@Technici4n
Copy link
Contributor

This should be fixed in BG2. I don't want to add a null check in MI because it would then silently void items.

@Technici4n Technici4n closed this as not planned Won't fix, can't repro, duplicate, stale Nov 21, 2024
@Technici4n Technici4n reopened this Nov 21, 2024
@Technici4n
Copy link
Contributor

Well for barrels it might be fine to return an empty one.

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

No branches or pull requests

2 participants