@Override public void onContainerClosed(EntityPlayer entityPlayer) { if (ioSlots.getStackInSlot(1) != null && !player.worldObj.isRemote) { entityPlayer.worldObj.spawnEntityInWorld( new EntityItem( player.worldObj, entityPlayer.posX, player.posY, player.posZ, ioSlots.getStackInSlot(1))); ioSlots.setInventorySlotContents(1, null); } super.onContainerClosed(entityPlayer); }
@Override public void detectAndSendChanges() { // todo check what values are being synced by the tile and remove // them from here if (LTOffline && reactor.reactorState != TileReactorCore.STATE_OFFLINE) { Iterator i = inventorySlots.iterator(); while (i.hasNext()) { Object o = i.next(); if (o instanceof SlotExtract || o instanceof SlotInsert) i.remove(); } sendObjectToClient(null, 99, 1); } else if (!LTOffline && reactor.reactorState == TileReactorCore.STATE_OFFLINE) { addSlotToContainer(new SlotInsert(ioSlots, 0, 15, 140, reactor)); addSlotToContainer(new SlotExtract(ioSlots, 1, 217, 140)); sendObjectToClient(null, 98, 1); } LTOffline = reactor.reactorState == TileReactorCore.STATE_OFFLINE; if (reactor.conversionUnit != LTConversionUnit) LTConversionUnit = (Integer) sendObjectToClient(null, 0, (int) (reactor.conversionUnit * 100)); // if ((int)reactor.reactionTemperature != LTReactionIntensity)LTReactionIntensity = (Integer) // sendObjectToClient(null, 1, (int) reactor.reactionTemperature); // if ((int)reactor.maxReactTemperature != LTMaxReactIntensity)LTMaxReactIntensity = (Integer) // sendObjectToClient(null, 2, (int) reactor.maxReactTemperature); // if ((int)reactor.fieldCharge != LTFieldStrength) LTFieldStrength = (Integer) // sendObjectToClient(null, 3, (int) reactor.fieldCharge); // if ((int)reactor.maxFieldCharge != LTMaxFieldStrength) LTMaxFieldStrength = (Integer) // sendObjectToClient(null, 7, (int) reactor.maxFieldCharge); // if (reactor.energySaturation != LTEnergySaturation) LTEnergySaturation = (Integer) // sendObjectToClient(null, 4, reactor.energySaturation); // if (reactor.maxEnergySaturation != LTMaxEnergySaturation) LTMaxEnergySaturation = (Integer) // sendObjectToClient(null, 5, reactor.maxEnergySaturation); // if (reactor.convertedFuel != LTFuelConversion) LTFuelConversion = (Integer) // sendObjectToClient(null, 6, reactor.convertedFuel); /*if (reactor.tempDrainFactor != LTTempDrainFactor) LTTempDrainFactor = (Integer) */ sendObjectToClient( null, 8, (int) (reactor.tempDrainFactor * 1000D)); if (reactor.generationRate != LTGenerationRate) LTGenerationRate = (Integer) sendObjectToClient(null, 9, (int) (reactor.generationRate)); if (reactor.fieldDrain != LTFieldDrain) LTFieldDrain = (Integer) sendObjectToClient(null, 10, reactor.fieldDrain); /*if (reactor.fuelUseRate != LTFuelUseRate) LTFuelUseRate = (Integer) */ sendObjectToClient( null, 11, (int) (reactor.fuelUseRate * 1000000D)); super.detectAndSendChanges(); }