IC2 Single-Use battery support

This commit is contained in:
Blood-Asp 2016-06-19 17:36:54 +02:00
parent 3a249d8075
commit 183a681d52

View file

@ -448,6 +448,12 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
for (int i = mMetaTileEntity.dechargerSlotStartIndex(), k = mMetaTileEntity.dechargerSlotCount() + i; i < k; i++) { for (int i = mMetaTileEntity.dechargerSlotStartIndex(), k = mMetaTileEntity.dechargerSlotCount() + i; i < k; i++) {
if (mMetaTileEntity.mInventory[i] != null && getStoredEU() < getEUCapacity()) { if (mMetaTileEntity.mInventory[i] != null && getStoredEU() < getEUCapacity()) {
dischargeItem(mMetaTileEntity.mInventory[i]); dischargeItem(mMetaTileEntity.mInventory[i]);
if(ic2.api.info.Info.itemEnergy.getEnergyValue(mMetaTileEntity.mInventory[i])>0){
if((getStoredEU() + ic2.api.info.Info.itemEnergy.getEnergyValue(mMetaTileEntity.mInventory[i]))<getEUCapacity()){
increaseStoredEnergyUnits((long)ic2.api.info.Info.itemEnergy.getEnergyValue(mMetaTileEntity.mInventory[i]),false);
mMetaTileEntity.mInventory[i].stackSize--;
}
}
if (mMetaTileEntity.mInventory[i].stackSize <= 0) if (mMetaTileEntity.mInventory[i].stackSize <= 0)
mMetaTileEntity.mInventory[i] = null; mMetaTileEntity.mInventory[i] = null;
mInventoryChanged = true; mInventoryChanged = true;