
Put annihilation plane on machine can cause the items to disappear
hinyb opened this issue · 3 comments
Checked for existing issues
- I have checked for existing issues, and have found none.
Tested latest version
- I have checked that this occurs on the latest version.
GregTech CEu Version
1.3.1
Minecraft Version
1.20.1
Recipe Viewer Installed
EMI
Environment
Singleplayer
Cross-Mod Interaction
Yes
Other Installed Mods
Appliedenergistics2-forge-15.2.11.jar
Expected Behavior
Expected to do nothing.
Actual Behavior
The covers on the machine will drop,and items in the machine's inventory will disappear.
Steps to Reproduce
Additional Information
I think there shouldn't call onDrops.
@Override
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
var context = builder.withParameter(LootContextParams.BLOCK_STATE, state).create(LootContextParamSets.BLOCK);
Entity entity = context.getParamOrNull(LootContextParams.THIS_ENTITY);
BlockEntity tileEntity = context.getParamOrNull(LootContextParams.BLOCK_ENTITY);
var drops = super.getDrops(state, builder);
if (tileEntity instanceof IMachineBlockEntity holder) {
var machine = holder.getMetaMachine();
for (Direction direction : GTUtil.DIRECTIONS) {
machine.getCoverContainer().removeCover(direction, null);
}
if (machine instanceof IMachineModifyDrops machineModifyDrops && entity instanceof Player) {
machineModifyDrops.onDrops(drops, (Player) entity);
}
if (machine instanceof IDropSaveMachine dropSaveMachine && dropSaveMachine.saveBreak()) {
for (ItemStack drop : drops) {
if (drop.getItem() instanceof MetaMachineItem item && item.getBlock() == this) {
dropSaveMachine.saveToItem(drop.getOrCreateTag());
// break here to not dupe contents if a machine drops multiple of itself for whatever reason.
break;
}
}
}
}
return drops;
}
why are you annihilation planing machines, anyway?
Honestly, the solution here might just be to auto-apply the tag ae2:blacklisted/annihilation_plane
to GTMachines &/|| things that need it in GTM. I don't really think a what is effectively a TE should be capable of being removed by a plane for any reason.