Attempting to find an energy transfer issue
This commit is contained in:
parent
235c3f20a2
commit
d6ad61114e
8 changed files with 71 additions and 104 deletions
|
@ -135,34 +135,25 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
|
|||
{
|
||||
if(FMLCommonHandler.instance().getEffectiveSide().isClient())
|
||||
{
|
||||
return energyToSend;
|
||||
return 0;
|
||||
}
|
||||
|
||||
double prevEnergy = energyToSend;
|
||||
double sent;
|
||||
|
||||
energyToSend = doEmit(energyToSend);
|
||||
sent = prevEnergy-energyToSend;
|
||||
double sent = 0;
|
||||
boolean tryAgain = false;
|
||||
|
||||
boolean tryAgain = energyToSend > 0 && sent > 0;
|
||||
|
||||
while(tryAgain)
|
||||
{
|
||||
do {
|
||||
tryAgain = false;
|
||||
|
||||
prevEnergy = energyToSend;
|
||||
sent = 0;
|
||||
double prev = sent;
|
||||
sent += doEmit(energyToSend-sent);
|
||||
|
||||
energyToSend -= (energyToSend - doEmit(energyToSend));
|
||||
sent = prevEnergy-energyToSend;
|
||||
|
||||
if(energyToSend > 0 && sent > 0)
|
||||
if(energyToSend-sent > 0 && sent-prev > 0)
|
||||
{
|
||||
tryAgain = true;
|
||||
}
|
||||
}
|
||||
} while(tryAgain);
|
||||
|
||||
return energyToSend;
|
||||
return sent;
|
||||
}
|
||||
|
||||
public synchronized double emit(double energyToSend)
|
||||
|
@ -173,12 +164,11 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
|
|||
}
|
||||
|
||||
/**
|
||||
* @return rejects
|
||||
* @return sent
|
||||
*/
|
||||
public synchronized double doEmit(double energyToSend)
|
||||
{
|
||||
double energyAvailable = energyToSend;
|
||||
double sent;
|
||||
{
|
||||
double sent = 0;
|
||||
|
||||
List availableAcceptors = Arrays.asList(getAcceptors().toArray());
|
||||
|
||||
|
@ -207,19 +197,19 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
|
|||
|
||||
if(acceptor instanceof IStrictEnergyAcceptor)
|
||||
{
|
||||
energyToSend -= (currentSending - ((IStrictEnergyAcceptor)acceptor).transferEnergyToAcceptor(side.getOpposite(), currentSending));
|
||||
sent += (currentSending - ((IStrictEnergyAcceptor)acceptor).transferEnergyToAcceptor(side.getOpposite(), currentSending));
|
||||
}
|
||||
else if(acceptor instanceof IEnergyHandler)
|
||||
{
|
||||
IEnergyHandler handler = (IEnergyHandler)acceptor;
|
||||
int used = handler.receiveEnergy(side.getOpposite(), (int)Math.round(currentSending*Mekanism.TO_TE), false);
|
||||
energyToSend -= used*Mekanism.FROM_TE;
|
||||
sent += used*Mekanism.FROM_TE;
|
||||
}
|
||||
else if(acceptor instanceof IEnergySink)
|
||||
{
|
||||
double toSend = Math.min(currentSending, ((IEnergySink)acceptor).getMaxSafeInput()*Mekanism.FROM_IC2);
|
||||
toSend = Math.min(toSend, ((IEnergySink)acceptor).demandedEnergyUnits()*Mekanism.FROM_IC2);
|
||||
energyToSend -= (toSend - (((IEnergySink)acceptor).injectEnergyUnits(side.getOpposite(), toSend*Mekanism.TO_IC2)*Mekanism.FROM_IC2));
|
||||
sent += (toSend - (((IEnergySink)acceptor).injectEnergyUnits(side.getOpposite(), toSend*Mekanism.TO_IC2)*Mekanism.FROM_IC2));
|
||||
}
|
||||
else if(acceptor instanceof IPowerReceptor && MekanismUtils.useBuildcraft())
|
||||
{
|
||||
|
@ -228,17 +218,16 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
|
|||
if(receiver != null)
|
||||
{
|
||||
float toSend = receiver.receiveEnergy(Type.PIPE, (float)(Math.min(receiver.powerRequest(), currentSending*Mekanism.TO_BC)), side.getOpposite());
|
||||
energyToSend -= toSend*Mekanism.FROM_BC;
|
||||
sent += toSend*Mekanism.FROM_BC;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sent = energyAvailable - energyToSend;
|
||||
joulesTransmitted += sent;
|
||||
}
|
||||
|
||||
return energyToSend;
|
||||
return sent;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -415,7 +404,7 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
|
|||
|
||||
if(electricityStored > 0)
|
||||
{
|
||||
electricityStored -= (electricityStored - tickEmit(electricityStored));
|
||||
electricityStored -= tickEmit(electricityStored);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,8 +33,6 @@ import net.minecraft.util.DamageSource;
|
|||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import universalelectricity.core.item.ElectricItemHelper;
|
||||
import universalelectricity.core.item.IItemElectric;
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
|
||||
public class EntityRobit extends EntityCreature implements IInventory, ISustainedInventory, IEntityBreathable
|
||||
|
@ -164,10 +162,6 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine
|
|||
{
|
||||
setEnergy(getEnergy() + EnergizedItemManager.discharge(inventory[27], MAX_ELECTRICITY - getEnergy()));
|
||||
}
|
||||
else if(inventory[27].getItem() instanceof IItemElectric)
|
||||
{
|
||||
setEnergy(getEnergy() + ElectricItemHelper.dischargeItem(inventory[27], (float)(MAX_ELECTRICITY - getEnergy())));
|
||||
}
|
||||
else if(Mekanism.hooks.IC2Loaded && inventory[27].getItem() instanceof IElectricItem)
|
||||
{
|
||||
IElectricItem item = (IElectricItem)inventory[27].getItem();
|
||||
|
|
|
@ -63,6 +63,13 @@ public class ItemBalloon extends ItemMekanism
|
|||
@Override
|
||||
public String getItemDisplayName(ItemStack stack)
|
||||
{
|
||||
String color = getColor(stack).getName();
|
||||
|
||||
if(getColor(stack) == EnumColor.BLACK)
|
||||
{
|
||||
color = EnumColor.DARK_GREY + getColor(stack).getLocalizedName();
|
||||
}
|
||||
|
||||
return getColor(stack).getName() + " " + MekanismUtils.localize("tooltip.balloon");
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ public class MultipartMekanism implements IPartFactory, IPartConverter
|
|||
"mekanism:restrictive_transporter", "mekanism:diversion_transporter"});
|
||||
|
||||
MultipartGenerator.registerPassThroughInterface("mekanism.api.transmitters.ITransmitter");
|
||||
MultipartGenerator.registerPassThroughInterface("mekanism.api.IStrictEnergyAcceptor");
|
||||
MultipartGenerator.registerPassThroughInterface("mekanism.api.energy.IStrictEnergyAcceptor");
|
||||
MultipartGenerator.registerPassThroughInterface("mekanism.api.transmitters.IGridTransmitter");
|
||||
MultipartGenerator.registerPassThroughInterface("mekanism.common.ILogisticalTransporter");
|
||||
MultipartGenerator.registerPassThroughInterface("ic2.api.energy.tile.IEnergySink");
|
||||
|
|
|
@ -308,7 +308,7 @@ public class PartUniversalCable extends PartTransmitter<EnergyNetwork> implement
|
|||
@Override
|
||||
public boolean canReceiveEnergy(ForgeDirection side)
|
||||
{
|
||||
return false;
|
||||
return getConnectionType(side) == ConnectionType.NORMAL || getConnectionType(side) == ConnectionType.PULL;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -25,11 +25,8 @@ import net.minecraft.entity.EntityLivingBase;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.core.item.ElectricItemHelper;
|
||||
import universalelectricity.core.item.IItemElectric;
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
@ -131,10 +128,6 @@ public class TileEntityChargepad extends TileEntityElectricBlock implements IAct
|
|||
{
|
||||
setEnergy(getEnergy() - EnergizedItemManager.charge(itemstack, getEnergy()));
|
||||
}
|
||||
else if(itemstack.getItem() instanceof IItemElectric)
|
||||
{
|
||||
setEnergy(getEnergy() - ElectricItemHelper.chargeItem(itemstack, (float)getEnergy()));
|
||||
}
|
||||
else if(Mekanism.hooks.IC2Loaded && itemstack.getItem() instanceof IElectricItem)
|
||||
{
|
||||
double sent = ElectricItem.manager.charge(itemstack, (int)(getEnergy()*Mekanism.TO_IC2), 4, true, false)*Mekanism.FROM_IC2;
|
||||
|
|
|
@ -17,11 +17,6 @@ import mekanism.common.Mekanism;
|
|||
import mekanism.common.tileentity.TileEntityElectricBlock;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.core.block.IConductor;
|
||||
import universalelectricity.core.block.IElectrical;
|
||||
import universalelectricity.core.electricity.ElectricityHelper;
|
||||
import universalelectricity.core.electricity.ElectricityPack;
|
||||
import universalelectricity.core.grid.IElectricityNetwork;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
import buildcraft.api.power.PowerHandler.Type;
|
||||
|
@ -45,12 +40,9 @@ public final class CableUtils
|
|||
if(acceptor instanceof IStrictEnergyAcceptor ||
|
||||
acceptor instanceof IEnergySink ||
|
||||
(acceptor instanceof IPowerReceptor && !(acceptor instanceof IGridTransmitter) && MekanismUtils.useBuildcraft()) ||
|
||||
acceptor instanceof IElectrical || acceptor instanceof IEnergyHandler)
|
||||
acceptor instanceof IEnergyHandler)
|
||||
{
|
||||
if(!(acceptor instanceof IConductor))
|
||||
{
|
||||
acceptors[orientation.ordinal()] = acceptor;
|
||||
}
|
||||
acceptors[orientation.ordinal()] = acceptor;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,7 +132,6 @@ public final class CableUtils
|
|||
|
||||
if((outputter instanceof ICableOutputter && ((ICableOutputter)outputter).canOutputTo(orientation.getOpposite())) ||
|
||||
(outputter instanceof IEnergySource && ((IEnergySource)outputter).emitsEnergyTo(tileEntity, orientation.getOpposite())) ||
|
||||
(outputter instanceof IElectrical && ((IElectrical)outputter).canConnect(orientation.getOpposite())) ||
|
||||
(outputter instanceof IEnergyHandler && ((IEnergyHandler)outputter).canInterface(orientation.getOpposite())))
|
||||
{
|
||||
outputters[orientation.ordinal()] = outputter;
|
||||
|
@ -175,32 +166,35 @@ public final class CableUtils
|
|||
return false;
|
||||
}
|
||||
|
||||
if(tileEntity instanceof IStrictEnergyAcceptor && ((IStrictEnergyAcceptor)tileEntity).canReceiveEnergy(side.getOpposite()))
|
||||
if(tileEntity instanceof IStrictEnergyAcceptor)
|
||||
{
|
||||
return true;
|
||||
if(((IStrictEnergyAcceptor)tileEntity).canReceiveEnergy(side.getOpposite()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(tileEntity instanceof IEnergyAcceptor && ((IEnergyAcceptor)tileEntity).acceptsEnergyFrom(orig, side.getOpposite()))
|
||||
else if(tileEntity instanceof IEnergyAcceptor)
|
||||
{
|
||||
return true;
|
||||
if(((IEnergyAcceptor)tileEntity).acceptsEnergyFrom(orig, side.getOpposite()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(tileEntity instanceof ICableOutputter && ((ICableOutputter)tileEntity).canOutputTo(side.getOpposite()))
|
||||
else if(tileEntity instanceof ICableOutputter)
|
||||
{
|
||||
return true;
|
||||
if(((ICableOutputter)tileEntity).canOutputTo(side.getOpposite()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(tileEntity instanceof IElectrical && ((IElectrical)tileEntity).canConnect(side.getOpposite()))
|
||||
else if(tileEntity instanceof IEnergyHandler)
|
||||
{
|
||||
return true;
|
||||
if(((IEnergyHandler)tileEntity).canInterface(side.getOpposite()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(tileEntity instanceof IEnergyHandler && ((IEnergyHandler)tileEntity).canInterface(side.getOpposite()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if(tileEntity instanceof IPowerReceptor && !(tileEntity instanceof IGridTransmitter) && MekanismUtils.useBuildcraft())
|
||||
else if(tileEntity instanceof IPowerReceptor && !(tileEntity instanceof IGridTransmitter) && MekanismUtils.useBuildcraft())
|
||||
{
|
||||
if(!(tileEntity instanceof IEnergyAcceptor) || ((IEnergyAcceptor)tileEntity).acceptsEnergyFrom(null, side.getOpposite()))
|
||||
{
|
||||
|
@ -235,22 +229,22 @@ public final class CableUtils
|
|||
|
||||
if(outputtingSides.size() > 0)
|
||||
{
|
||||
double totalToSend = sendingEnergy;
|
||||
double sent = 0;
|
||||
|
||||
boolean cont = false;
|
||||
|
||||
do {
|
||||
cont = false;
|
||||
double prev = totalToSend;
|
||||
totalToSend -= (totalToSend - emit_do(emitter, outputtingSides, totalToSend));
|
||||
double prev = sent;
|
||||
sent += emit_do(emitter, outputtingSides, sendingEnergy-sent);
|
||||
|
||||
if(prev-totalToSend > 0 && totalToSend > 0)
|
||||
if(sendingEnergy-sent > 0 && sent-prev > 0)
|
||||
{
|
||||
cont = true;
|
||||
}
|
||||
} while(cont);
|
||||
|
||||
emitter.setEnergy(emitter.getEnergy() - (sendingEnergy - totalToSend));
|
||||
emitter.setEnergy(emitter.getEnergy() - sent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -260,6 +254,7 @@ public final class CableUtils
|
|||
{
|
||||
double remains = totalToSend%outputtingSides.size();
|
||||
double splitSend = (totalToSend-remains)/outputtingSides.size();
|
||||
double sent = 0;
|
||||
|
||||
List<ForgeDirection> toRemove = new ArrayList<ForgeDirection>();
|
||||
|
||||
|
@ -269,10 +264,10 @@ public final class CableUtils
|
|||
double toSend = splitSend+remains;
|
||||
remains = 0;
|
||||
|
||||
double prev = totalToSend;
|
||||
totalToSend -= (toSend - emit_do_do(emitter, tileEntity, side, toSend));
|
||||
double prev = sent;
|
||||
sent += emit_do_do(emitter, tileEntity, side, toSend);
|
||||
|
||||
if(prev-totalToSend == 0)
|
||||
if(sent-prev == 0)
|
||||
{
|
||||
toRemove.add(side);
|
||||
}
|
||||
|
@ -283,18 +278,20 @@ public final class CableUtils
|
|||
outputtingSides.remove(side);
|
||||
}
|
||||
|
||||
return totalToSend;
|
||||
return sent;
|
||||
}
|
||||
|
||||
private static double emit_do_do(TileEntityElectricBlock from, TileEntity tileEntity, ForgeDirection side, double sendingEnergy)
|
||||
{
|
||||
double sent = 0;
|
||||
|
||||
if(tileEntity instanceof IStrictEnergyAcceptor)
|
||||
{
|
||||
IStrictEnergyAcceptor acceptor = (IStrictEnergyAcceptor)tileEntity;
|
||||
|
||||
if(acceptor.canReceiveEnergy(side.getOpposite()))
|
||||
{
|
||||
sendingEnergy -= (sendingEnergy - acceptor.transferEnergyToAcceptor(side.getOpposite(), sendingEnergy));
|
||||
sent += (sendingEnergy - acceptor.transferEnergyToAcceptor(side.getOpposite(), sendingEnergy));
|
||||
}
|
||||
}
|
||||
else if(tileEntity instanceof IEnergyHandler)
|
||||
|
@ -304,7 +301,7 @@ public final class CableUtils
|
|||
if(handler.canInterface(side.getOpposite()))
|
||||
{
|
||||
int used = handler.receiveEnergy(side.getOpposite(), (int)Math.round(sendingEnergy*Mekanism.TO_TE), false);
|
||||
sendingEnergy -= used*Mekanism.FROM_TE;
|
||||
sent += used*Mekanism.FROM_TE;
|
||||
}
|
||||
}
|
||||
else if(tileEntity instanceof IEnergySink)
|
||||
|
@ -313,7 +310,7 @@ public final class CableUtils
|
|||
{
|
||||
double toSend = Math.min(sendingEnergy, Math.min(((IEnergySink)tileEntity).getMaxSafeInput(), ((IEnergySink)tileEntity).demandedEnergyUnits())*Mekanism.FROM_IC2);
|
||||
double rejects = ((IEnergySink)tileEntity).injectEnergyUnits(side.getOpposite(), toSend*Mekanism.TO_IC2)*Mekanism.FROM_IC2;
|
||||
sendingEnergy -= (toSend - rejects);
|
||||
sent += (toSend - rejects);
|
||||
}
|
||||
}
|
||||
else if(tileEntity instanceof IPowerReceptor && MekanismUtils.useBuildcraft())
|
||||
|
@ -323,11 +320,11 @@ public final class CableUtils
|
|||
if(receiver != null)
|
||||
{
|
||||
double transferEnergy = Math.min(sendingEnergy, receiver.powerRequest()*Mekanism.FROM_BC);
|
||||
float sent = receiver.receiveEnergy(Type.STORAGE, (float)(transferEnergy*Mekanism.TO_BC), side.getOpposite());
|
||||
sendingEnergy -= sent;
|
||||
float used = receiver.receiveEnergy(Type.STORAGE, (float)(transferEnergy*Mekanism.TO_BC), side.getOpposite());
|
||||
sent += used*Mekanism.FROM_BC;
|
||||
}
|
||||
}
|
||||
|
||||
return sendingEnergy;
|
||||
return sent;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import mekanism.common.Mekanism;
|
|||
import mekanism.common.tileentity.TileEntityElectricBlock;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import universalelectricity.core.item.ElectricItemHelper;
|
||||
import universalelectricity.core.item.IItemElectric;
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
|
||||
|
@ -27,10 +26,6 @@ public final class ChargeUtils
|
|||
{
|
||||
storer.setEnergy(storer.getEnergy() + EnergizedItemManager.discharge(storer.inventory[slotID], storer.getMaxEnergy() - storer.getEnergy()));
|
||||
}
|
||||
else if(storer.inventory[slotID].getItem() instanceof IItemElectric)
|
||||
{
|
||||
storer.setEnergy(storer.getEnergy() + ElectricItemHelper.dischargeItem(storer.inventory[slotID], (float)((storer.getMaxEnergy() - storer.getEnergy())*Mekanism.TO_UE)));
|
||||
}
|
||||
else if(Mekanism.hooks.IC2Loaded && storer.inventory[slotID].getItem() instanceof IElectricItem)
|
||||
{
|
||||
IElectricItem item = (IElectricItem)storer.inventory[slotID].getItem();
|
||||
|
@ -77,10 +72,6 @@ public final class ChargeUtils
|
|||
{
|
||||
storer.setEnergy(storer.getEnergy() - EnergizedItemManager.charge(storer.inventory[slotID], storer.getEnergy()));
|
||||
}
|
||||
else if(storer.inventory[slotID].getItem() instanceof IItemElectric)
|
||||
{
|
||||
storer.setEnergy(storer.getEnergy() - ElectricItemHelper.chargeItem(storer.inventory[slotID], (float)(storer.getEnergy()*Mekanism.TO_UE)));
|
||||
}
|
||||
else if(Mekanism.hooks.IC2Loaded && storer.inventory[slotID].getItem() instanceof IElectricItem)
|
||||
{
|
||||
double sent = ElectricItem.manager.charge(storer.inventory[slotID], (int)(storer.getEnergy()*Mekanism.TO_IC2), 4, true, false)*Mekanism.FROM_IC2;
|
||||
|
@ -107,8 +98,7 @@ public final class ChargeUtils
|
|||
public static boolean canBeDischarged(ItemStack itemstack)
|
||||
{
|
||||
return (itemstack.getItem() instanceof IElectricItem && ((IElectricItem)itemstack.getItem()).canProvideEnergy(itemstack)) ||
|
||||
(itemstack.getItem() instanceof IEnergizedItem && ((IEnergizedItem)itemstack.getItem()).canSend(itemstack)) ||
|
||||
(itemstack.getItem() instanceof IItemElectric && ((IItemElectric)itemstack.getItem()).discharge(itemstack, 1, false) != 0) ||
|
||||
(itemstack.getItem() instanceof IEnergizedItem && ((IEnergizedItem)itemstack.getItem()).canSend(itemstack)) ||
|
||||
(itemstack.getItem() instanceof IEnergyContainerItem && ((IEnergyContainerItem)itemstack.getItem()).extractEnergy(itemstack, 1, true) != 0) ||
|
||||
itemstack.itemID == Item.redstone.itemID;
|
||||
}
|
||||
|
@ -122,7 +112,6 @@ public final class ChargeUtils
|
|||
{
|
||||
return itemstack.getItem() instanceof IElectricItem ||
|
||||
(itemstack.getItem() instanceof IEnergizedItem && ((IEnergizedItem)itemstack.getItem()).canReceive(itemstack)) ||
|
||||
(itemstack.getItem() instanceof IItemElectric && ((IItemElectric)itemstack.getItem()).recharge(itemstack, 1, false) != 0) ||
|
||||
(itemstack.getItem() instanceof IEnergyContainerItem && ((IEnergyContainerItem)itemstack.getItem()).receiveEnergy(itemstack, 1, true) != 0);
|
||||
}
|
||||
|
||||
|
@ -137,13 +126,11 @@ public final class ChargeUtils
|
|||
{
|
||||
if(chargeSlot)
|
||||
{
|
||||
return (itemstack.getItem() instanceof IItemElectric && ((IItemElectric)itemstack.getItem()).recharge(itemstack, 1, false) == 0) ||
|
||||
(itemstack.getItem() instanceof IElectricItem && (!(itemstack.getItem() instanceof IItemElectric) ||
|
||||
return (itemstack.getItem() instanceof IElectricItem && (!(itemstack.getItem() instanceof IItemElectric) ||
|
||||
((IItemElectric)itemstack.getItem()).recharge(itemstack, 1, false) == 0));
|
||||
}
|
||||
else {
|
||||
return (itemstack.getItem() instanceof IItemElectric && ((IItemElectric)itemstack.getItem()).discharge(itemstack, 1, false) == 0) ||
|
||||
(itemstack.getItem() instanceof IElectricItem && ((IElectricItem)itemstack.getItem()).canProvideEnergy(itemstack) &&
|
||||
return (itemstack.getItem() instanceof IElectricItem && ((IElectricItem)itemstack.getItem()).canProvideEnergy(itemstack) &&
|
||||
(!(itemstack.getItem() instanceof IItemElectric) ||
|
||||
((IItemElectric)itemstack.getItem()).discharge(itemstack, 1, false) == 0));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue