Skip to content
Permalink
Browse files

Adjust something to handle IC2's quirkiness.

Signed-off-by: King Lemming <kinglemming@gmail.com>
  • Loading branch information...
KingLemming committed May 14, 2019
1 parent b42b432 commit a47b122aab44227b3b346cd907e7388c8cbcc3b2
Showing with 38 additions and 1 deletion.
  1. +38 −1 src/main/java/cofh/thermaldynamics/block/BlockTDBase.java
@@ -145,7 +145,44 @@ public float getExplosionResistance(World world, BlockPos pos, Entity exploder,
@Override
public ArrayList<ItemStack> dropDelegate(NBTTagCompound nbt, IBlockAccess world, BlockPos pos, int fortune) {

return dismantleDelegate(nbt, (World) world, pos, null, false, true);
TileEntity tile = world.getTileEntity(pos);
IBlockState state = world.getBlockState(pos);
int meta = state.getBlock().getMetaFromState(state);
ArrayList<ItemStack> ret = new ArrayList<>();

if (state.getBlock() != this) {
return ret;
}
ItemStack dropBlock = tile instanceof TileGrid ? ((TileGrid) tile).getDrop() : new ItemStack(this, 1, meta);

if (nbt != null) {
if (nbt.hasKey(CoreProps.ENERGY)) {
nbt.removeTag(CoreProps.ENERGY);
}
if (!nbt.hasNoTags()) {
dropBlock.setTagCompound(nbt);
}
}
ret.add(dropBlock);

if (tile instanceof TileGrid) {
TileGrid ductBase = (TileGrid) tile;
TileGrid.AttachmentData attachmentData = ductBase.attachmentData;
if (attachmentData != null) {
for (Attachment attachment : attachmentData.attachments) {
if (attachment != null) {
ret.addAll(attachment.getDrops());
}
}
for (Cover cover : attachmentData.covers) {
if (cover != null) {
ret.addAll(cover.getDrops());
}
}
}
ductBase.dropAdditional(ret);
}
return ret;
}

@Override

0 comments on commit a47b122

Please sign in to comment.
You can’t perform that action at this time.