Merge pull request #39 from p1rx/patch-1

Fixed scanning of GregTech machines with ShipScanner.
This commit is contained in:
Cr0s 2014-08-13 20:52:26 +04:00
commit 597d216e33

View file

@ -369,16 +369,29 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
if (blockID != 0) {
TileEntity te = worldObj.getBlockTileEntity(core.minX + x, core.minY + y, core.minZ + z);
if (te != null && !(te instanceof IInventory))
if (te != null/* && !(te instanceof IInventory)*/)
{
try {
NBTTagCompound tileTag = new NBTTagCompound();
te.writeToNBT(tileTag);
// Clear inventory.
if (te instanceof IInventory) {
TileEntity tmp_te = TileEntity.createAndLoadEntity(tileTag);
if (tmp_te instanceof IInventory)
for (int i = 0; i < ((IInventory)tmp_te).getSizeInventory(); i++)
((IInventory)tmp_te).setInventorySlotContents(i, null);
tmp_te.writeToNBT(tileTag);
}
// Remove energy from energy storages
if (te instanceof IEnergyTile) {
// IC2
if (tileTag.hasKey("energy"))
tileTag.setInteger("energy", 0);
// Gregtech
if (tileTag.hasKey("mStoredEnergy"))
tileTag.setInteger("mStoredEnergy", 0);
}
// Transform TE's coordinates from local axis to .schematic offset-axis