Kill BuildCraft energy support once and for all, thanks to the excellent work of KingLemming.
This commit is contained in:
parent
75cccf96a8
commit
1f2e792146
15 changed files with 23 additions and 375 deletions
|
@ -11,12 +11,10 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.energy.IStrictEnergyAcceptor;
|
||||
import mekanism.api.transmitters.DynamicNetwork;
|
||||
import mekanism.api.transmitters.ITransmitter;
|
||||
import mekanism.api.transmitters.TransmissionType;
|
||||
import mekanism.common.tileentity.TileEntityUniversalCable;
|
||||
import mekanism.common.util.CableUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -25,9 +23,6 @@ import net.minecraftforge.common.MinecraftForge;
|
|||
import net.minecraftforge.event.Event;
|
||||
import universalelectricity.core.block.IElectrical;
|
||||
import universalelectricity.core.electricity.ElectricityPack;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
import buildcraft.api.power.PowerHandler.Type;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
||||
|
@ -102,10 +97,6 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
|
|||
{
|
||||
totalNeeded += Math.min((((IEnergySink)acceptor).demandedEnergyUnits()*Mekanism.FROM_IC2), (((IEnergySink)acceptor).getMaxSafeInput()*Mekanism.FROM_IC2));
|
||||
}
|
||||
else if(acceptor instanceof IPowerReceptor && MekanismUtils.useBuildcraft())
|
||||
{
|
||||
totalNeeded += (((IPowerReceptor)acceptor).getPowerReceiver(side).powerRequest()*Mekanism.FROM_BC);
|
||||
}
|
||||
else if(acceptor instanceof IElectrical)
|
||||
{
|
||||
totalNeeded += ((IElectrical)acceptor).getRequest(side)*Mekanism.FROM_UE;
|
||||
|
@ -194,16 +185,6 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
|
|||
toSend = Math.min(toSend, ((IEnergySink)acceptor).demandedEnergyUnits()*Mekanism.FROM_IC2);
|
||||
energyToSend -= (toSend - (((IEnergySink)acceptor).injectEnergyUnits(side.getOpposite(), toSend*Mekanism.TO_IC2)*Mekanism.FROM_IC2));
|
||||
}
|
||||
else if(acceptor instanceof IPowerReceptor && MekanismUtils.useBuildcraft())
|
||||
{
|
||||
PowerReceiver receiver = ((IPowerReceptor)acceptor).getPowerReceiver(side.getOpposite());
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
else if(acceptor instanceof IElectrical)
|
||||
{
|
||||
double toSend = Math.min(currentSending, ((IElectrical)acceptor).getRequest(side.getOpposite())*Mekanism.FROM_UE);
|
||||
|
@ -288,23 +269,6 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
|
|||
}
|
||||
}
|
||||
}
|
||||
else if(acceptor instanceof IPowerReceptor && MekanismUtils.useBuildcraft())
|
||||
{
|
||||
IPowerReceptor handler = (IPowerReceptor)acceptor;
|
||||
|
||||
if(handler.getPowerReceiver(side.getOpposite()) != null)
|
||||
{
|
||||
if((handler.getPowerReceiver(side.getOpposite()).powerRequest()*Mekanism.FROM_BC) > 0)
|
||||
{
|
||||
TileEntityUniversalCable cable = (TileEntityUniversalCable)Object3D.get(acceptor).getFromSide(side.getOpposite()).getTileEntity(acceptor.worldObj);
|
||||
|
||||
if(cable != null && !cable.getBuildCraftIgnored().contains(acceptor))
|
||||
{
|
||||
toReturn.add(acceptor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return toReturn;
|
||||
|
|
|
@ -2,18 +2,17 @@ package mekanism.common;
|
|||
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
import ic2.api.energy.tile.IEnergyTile;
|
||||
import universalelectricity.core.block.IConnector;
|
||||
import universalelectricity.core.block.IElectrical;
|
||||
import universalelectricity.core.block.IElectricalStorage;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.energy.IStrictEnergyAcceptor;
|
||||
import mekanism.api.energy.IStrictEnergyStorage;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import universalelectricity.core.block.IConnector;
|
||||
import universalelectricity.core.block.IElectrical;
|
||||
import universalelectricity.core.block.IElectricalStorage;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
|
||||
public interface IAdvancedBoundingBlock extends IBoundingBlock, ISidedInventory, IEnergySink, IStrictEnergyAcceptor, IPowerReceptor, IEnergyTile, IElectrical, IElectricalStorage, IConnector, IStrictEnergyStorage, IEnergyHandler
|
||||
public interface IAdvancedBoundingBlock extends IBoundingBlock, ISidedInventory, IEnergySink, IStrictEnergyAcceptor, IEnergyTile, IElectrical, IElectricalStorage, IConnector, IStrictEnergyStorage, IEnergyHandler
|
||||
{
|
||||
public int[] getBoundSlots(Object3D location, int side);
|
||||
|
||||
|
|
|
@ -1172,6 +1172,7 @@ public class Mekanism
|
|||
donators.add("ejmiv89");
|
||||
donators.add("Greylocke");
|
||||
donators.add("darkphan");
|
||||
donators.add("mallrat208");
|
||||
|
||||
//Load proxy
|
||||
proxy.registerRenderInformation();
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
package mekanism.common.tileentity;
|
||||
|
||||
import universalelectricity.core.block.IConnector;
|
||||
import universalelectricity.core.block.IElectrical;
|
||||
import universalelectricity.core.block.IElectricalStorage;
|
||||
import universalelectricity.core.electricity.ElectricityPack;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.api.power.PowerHandler;
|
||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
import ic2.api.energy.tile.IEnergyTile;
|
||||
import mekanism.api.Object3D;
|
||||
|
@ -18,10 +10,14 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.core.block.IConnector;
|
||||
import universalelectricity.core.block.IElectrical;
|
||||
import universalelectricity.core.block.IElectricalStorage;
|
||||
import universalelectricity.core.electricity.ElectricityPack;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
|
||||
public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock implements ISidedInventory, IEnergySink, IStrictEnergyAcceptor, IPowerReceptor, IEnergyTile, IElectrical, IElectricalStorage, IConnector, IStrictEnergyStorage, IEnergyHandler
|
||||
public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock implements ISidedInventory, IEnergySink, IStrictEnergyAcceptor, IEnergyTile, IElectrical, IElectricalStorage, IConnector, IStrictEnergyStorage, IEnergyHandler
|
||||
{
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
|
@ -381,39 +377,6 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp
|
|||
return getInv().getVoltage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PowerReceiver getPowerReceiver(ForgeDirection side)
|
||||
{
|
||||
if(getInv() == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getInv().getPowerReceiver(side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doWork(PowerHandler workProvider)
|
||||
{
|
||||
if(getInv() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
getInv().doWork(workProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld()
|
||||
{
|
||||
if(getInv() == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getInv().getWorld();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double transferEnergyToAcceptor(ForgeDirection side, double amount)
|
||||
{
|
||||
|
|
|
@ -18,21 +18,17 @@ import mekanism.common.Mekanism;
|
|||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import universalelectricity.core.block.IConnector;
|
||||
import universalelectricity.core.block.IElectrical;
|
||||
import universalelectricity.core.block.IElectricalStorage;
|
||||
import universalelectricity.core.electricity.ElectricityPack;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.api.power.PowerHandler;
|
||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
public abstract class TileEntityElectricBlock extends TileEntityContainerBlock implements ITileNetwork, IPowerReceptor, IEnergyTile, IElectrical, IElectricalStorage, IConnector, IStrictEnergyStorage, IEnergyHandler, IEnergySink, IEnergyStorage, IStrictEnergyAcceptor, ICableOutputter
|
||||
public abstract class TileEntityElectricBlock extends TileEntityContainerBlock implements ITileNetwork, IEnergyTile, IElectrical, IElectricalStorage, IConnector, IStrictEnergyStorage, IEnergyHandler, IEnergySink, IEnergyStorage, IStrictEnergyAcceptor, ICableOutputter
|
||||
{
|
||||
/** How much energy is stored in this block. */
|
||||
public double electricityStored;
|
||||
|
@ -40,9 +36,6 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
|
|||
/** Maximum amount of energy this machine can hold. */
|
||||
public double MAX_ELECTRICITY;
|
||||
|
||||
/** BuildCraft power handler. */
|
||||
public PowerHandler powerHandler;
|
||||
|
||||
/**
|
||||
* The base of all blocks that deal with electricity. It has a facing state, initialized state,
|
||||
* and a current amount of stored energy.
|
||||
|
@ -53,10 +46,6 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
|
|||
{
|
||||
super(name);
|
||||
MAX_ELECTRICITY = maxEnergy;
|
||||
|
||||
powerHandler = new PowerHandler(this, PowerHandler.Type.STORAGE);
|
||||
powerHandler.configurePowerPerdition(0, 0);
|
||||
powerHandler.configure(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
public void register()
|
||||
|
@ -72,10 +61,7 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
reconfigure();
|
||||
}
|
||||
public void onUpdate() {}
|
||||
|
||||
public EnumSet<ForgeDirection> getOutputtingSides()
|
||||
{
|
||||
|
@ -158,7 +144,6 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
|
|||
super.readFromNBT(nbtTags);
|
||||
|
||||
electricityStored = nbtTags.getDouble("electricityStored");
|
||||
reconfigure();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -169,42 +154,6 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
|
|||
nbtTags.setDouble("electricityStored", getEnergy());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PowerReceiver getPowerReceiver(ForgeDirection side)
|
||||
{
|
||||
return powerHandler.getPowerReceiver();
|
||||
}
|
||||
|
||||
protected void reconfigure()
|
||||
{
|
||||
if(MekanismUtils.useBuildcraft())
|
||||
{
|
||||
powerHandler.configure(1, (float)((getMaxEnergy()-getEnergy())*Mekanism.TO_BC), 0, (float)(getMaxEnergy()*Mekanism.TO_BC));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doWork(PowerHandler workProvider)
|
||||
{
|
||||
if(powerHandler.getEnergyStored() > 0)
|
||||
{
|
||||
if(getEnergy() < getMaxEnergy())
|
||||
{
|
||||
setEnergy(getEnergy() + powerHandler.useEnergy(0, (float)((getMaxEnergy()-getEnergy())*Mekanism.TO_BC), true)*Mekanism.FROM_BC);
|
||||
}
|
||||
|
||||
powerHandler.setEnergy(0);
|
||||
}
|
||||
|
||||
reconfigure();
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld()
|
||||
{
|
||||
return worldObj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float receiveElectricity(ForgeDirection from, ElectricityPack receive, boolean doReceive)
|
||||
{
|
||||
|
|
|
@ -2,7 +2,6 @@ package mekanism.common.tileentity;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.IRedstoneControl;
|
||||
|
@ -18,7 +17,6 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
|
@ -26,7 +24,7 @@ import dan200.computer.api.IComputerAccess;
|
|||
import dan200.computer.api.ILuaContext;
|
||||
import dan200.computer.api.IPeripheral;
|
||||
|
||||
public class TileEntityEnergyCube extends TileEntityElectricBlock implements IPowerReceptor, IPeripheral, IRedstoneControl
|
||||
public class TileEntityEnergyCube extends TileEntityElectricBlock implements IPeripheral, IRedstoneControl
|
||||
{
|
||||
/** This Energy Cube's tier. */
|
||||
public EnergyCubeTier tier = EnergyCubeTier.BASIC;
|
||||
|
|
|
@ -14,37 +14,21 @@ import mekanism.api.transmitters.TransmitterNetworkRegistry;
|
|||
import mekanism.common.EnergyNetwork;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.util.CableUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import universalelectricity.core.block.IElectrical;
|
||||
import universalelectricity.core.electricity.ElectricityPack;
|
||||
import universalelectricity.core.grid.IElectricityNetwork;
|
||||
import buildcraft.api.power.IPowerEmitter;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.api.power.PowerHandler;
|
||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
|
||||
public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwork> implements IPowerReceptor, IEnergySink, IEnergyHandler, IElectrical
|
||||
public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwork> implements IEnergySink, IEnergyHandler, IElectrical
|
||||
{
|
||||
/** A fake power handler used to initiate energy transfer calculations. */
|
||||
public PowerHandler powerHandler;
|
||||
|
||||
/** A fake UE ElectricityNetwork used to accept power from EU machines */
|
||||
public IElectricityNetwork ueNetwork;
|
||||
|
||||
public double energyScale;
|
||||
|
||||
public TileEntityUniversalCable()
|
||||
{
|
||||
powerHandler = new PowerHandler(this, PowerHandler.Type.STORAGE);
|
||||
powerHandler.configurePowerPerdition(0, 0);
|
||||
powerHandler.configure(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransmissionType getTransmissionType()
|
||||
{
|
||||
|
@ -144,7 +128,6 @@ public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwor
|
|||
}
|
||||
|
||||
getTransmitterNetwork().refresh();
|
||||
reconfigure();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -164,76 +147,6 @@ public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwor
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PowerReceiver getPowerReceiver(ForgeDirection side)
|
||||
{
|
||||
if(getTransmitterNetwork().getEnergyNeeded(new ArrayList()) == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return powerHandler.getPowerReceiver();
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld()
|
||||
{
|
||||
return worldObj;
|
||||
}
|
||||
|
||||
private void reconfigure()
|
||||
{
|
||||
if(MekanismUtils.useBuildcraft())
|
||||
{
|
||||
float needed = (float)(getTransmitterNetwork().getEnergyNeeded(getBuildCraftIgnored())*Mekanism.TO_BC);
|
||||
powerHandler.configure(1, needed, 0, needed);
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<TileEntity> getBuildCraftIgnored()
|
||||
{
|
||||
ArrayList<TileEntity> ignored = new ArrayList<TileEntity>();
|
||||
|
||||
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
TileEntity tile = Object3D.get(this).getFromSide(side).getTileEntity(worldObj);
|
||||
|
||||
if(tile != null)
|
||||
{
|
||||
if(powerHandler.powerSources[side.ordinal()] > 0)
|
||||
{
|
||||
ignored.add(tile);
|
||||
}
|
||||
else if(tile instanceof IPowerEmitter)
|
||||
{
|
||||
IPowerEmitter emitter = (IPowerEmitter)tile;
|
||||
|
||||
if(emitter.canEmitPowerFrom(side.getOpposite()))
|
||||
{
|
||||
ignored.add(tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ignored;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doWork(PowerHandler workProvider)
|
||||
{
|
||||
if(MekanismUtils.useBuildcraft())
|
||||
{
|
||||
if(powerHandler.getEnergyStored() > 0)
|
||||
{
|
||||
getTransmitterNetwork().emit(powerHandler.getEnergyStored()*Mekanism.FROM_BC, getBuildCraftIgnored());
|
||||
}
|
||||
|
||||
powerHandler.setEnergy(0);
|
||||
reconfigure();
|
||||
}
|
||||
}
|
||||
|
||||
public void setCachedEnergy(double scale)
|
||||
{
|
||||
|
@ -254,7 +167,7 @@ public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwor
|
|||
@Override
|
||||
public double demandedEnergyUnits()
|
||||
{
|
||||
return getTransmitterNetwork().getEnergyNeeded(getBuildCraftIgnored())*Mekanism.TO_IC2;
|
||||
return getTransmitterNetwork().getEnergyNeeded(new ArrayList())*Mekanism.TO_IC2;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,7 +6,6 @@ import ic2.api.energy.tile.IEnergySource;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.Object3D;
|
||||
|
@ -24,9 +23,6 @@ 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;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
|
||||
public final class CableUtils
|
||||
|
@ -44,10 +40,7 @@ public final class CableUtils
|
|||
{
|
||||
TileEntity acceptor = Object3D.get(tileEntity).getFromSide(orientation).getTileEntity(tileEntity.worldObj);
|
||||
|
||||
if(acceptor instanceof IStrictEnergyAcceptor ||
|
||||
acceptor instanceof IEnergySink ||
|
||||
(acceptor instanceof IPowerReceptor && !(acceptor instanceof ITransmitter) && MekanismUtils.useBuildcraft()) ||
|
||||
acceptor instanceof IElectrical || acceptor instanceof IEnergyHandler)
|
||||
if(acceptor instanceof IStrictEnergyAcceptor || acceptor instanceof IEnergySink || acceptor instanceof IElectrical || acceptor instanceof IEnergyHandler)
|
||||
{
|
||||
acceptors[orientation.ordinal()] = acceptor;
|
||||
}
|
||||
|
@ -184,17 +177,6 @@ public final class CableUtils
|
|||
return true;
|
||||
}
|
||||
|
||||
if(tileEntity instanceof IPowerReceptor && !(tileEntity instanceof ITransmitter) && MekanismUtils.useBuildcraft())
|
||||
{
|
||||
if(!(tileEntity instanceof IEnergyAcceptor) || ((IEnergyAcceptor)tileEntity).acceptsEnergyFrom(null, side.getOpposite()))
|
||||
{
|
||||
if(!(tileEntity instanceof IEnergySource) || ((IEnergySource)tileEntity).emitsEnergyTo(null, side.getOpposite()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -346,17 +328,6 @@ public final class CableUtils
|
|||
ElectricityPack pack = ElectricityPack.getFromWatts((float)(toSend*Mekanism.TO_UE), ((IElectrical)tileEntity).getVoltage());
|
||||
sendingEnergy -= (((IElectrical)tileEntity).receiveElectricity(side.getOpposite(), pack, true)*Mekanism.FROM_UE);
|
||||
}
|
||||
else if(tileEntity instanceof IPowerReceptor && MekanismUtils.useBuildcraft())
|
||||
{
|
||||
PowerReceiver receiver = ((IPowerReceptor)tileEntity).getPowerReceiver(side.getOpposite());
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
return sendingEnergy;
|
||||
}
|
||||
|
|
|
@ -16,9 +16,9 @@ import mekanism.api.EnumColor;
|
|||
import mekanism.api.Object3D;
|
||||
import mekanism.common.DynamicTankCache;
|
||||
import mekanism.common.IActiveState;
|
||||
import mekanism.common.IInvConfiguration;
|
||||
import mekanism.common.IFactory;
|
||||
import mekanism.common.IFactory.RecipeType;
|
||||
import mekanism.common.IInvConfiguration;
|
||||
import mekanism.common.IModule;
|
||||
import mekanism.common.IRedstoneControl;
|
||||
import mekanism.common.IRedstoneControl.RedstoneControl;
|
||||
|
@ -1116,11 +1116,6 @@ public final class MekanismUtils
|
|||
return ElectricityDisplay.getDisplayShort((float)(energy*Mekanism.TO_UE), ElectricUnit.JOULES);
|
||||
}
|
||||
|
||||
public static boolean useBuildcraft()
|
||||
{
|
||||
return Mekanism.hooks.BuildCraftLoaded || Mekanism.forceBuildcraft;
|
||||
}
|
||||
|
||||
public static String getCoordDisplay(Object3D obj)
|
||||
{
|
||||
return "[" + obj.xCoord + ", " + obj.yCoord + ", " + obj.zCoord + "]";
|
||||
|
|
|
@ -86,7 +86,7 @@ public final class TransporterUtils
|
|||
ForgeDirection forgeSide = ForgeDirection.getOrientation(side).getOpposite();
|
||||
|
||||
//Immature BuildCraft inv check
|
||||
if(MekanismUtils.useBuildcraft() && inventory instanceof IPowerReceptor)
|
||||
if(inventory instanceof IPowerReceptor)
|
||||
{
|
||||
if(((IPowerReceptor)inventory).getPowerReceiver(forgeSide) != null && ((IPowerReceptor)inventory).getPowerReceiver(forgeSide).getType() == Type.MACHINE)
|
||||
{
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
package mekanism.generators.common.tileentity;
|
||||
|
||||
import ic2.api.energy.tile.IEnergySource;
|
||||
import ic2.api.tile.IEnergyStorage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.energy.ICableOutputter;
|
||||
import mekanism.client.sound.IHasSound;
|
||||
import mekanism.common.IActiveState;
|
||||
import mekanism.common.IRedstoneControl;
|
||||
|
@ -16,15 +12,11 @@ import mekanism.common.PacketHandler;
|
|||
import mekanism.common.PacketHandler.Transmission;
|
||||
import mekanism.common.network.PacketTileEntity;
|
||||
import mekanism.common.tileentity.TileEntityElectricBlock;
|
||||
import mekanism.common.tileentity.TileEntityUniversalCable;
|
||||
import mekanism.common.util.CableUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import buildcraft.api.power.IPowerEmitter;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
|
@ -33,7 +25,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
import dan200.computer.api.IComputerAccess;
|
||||
import dan200.computer.api.IPeripheral;
|
||||
|
||||
public abstract class TileEntityGenerator extends TileEntityElectricBlock implements IPowerReceptor, IPeripheral, IActiveState, IHasSound, IRedstoneControl, IPowerEmitter
|
||||
public abstract class TileEntityGenerator extends TileEntityElectricBlock implements IPeripheral, IActiveState, IHasSound, IRedstoneControl
|
||||
{
|
||||
/** Output per tick this generator can transfer. */
|
||||
public double output;
|
||||
|
@ -60,8 +52,6 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
|
|||
{
|
||||
super(name, maxEnergy);
|
||||
|
||||
powerHandler.configure(0, 0, 0, 0);
|
||||
|
||||
output = out;
|
||||
isActive = false;
|
||||
controlType = RedstoneControl.DISABLED;
|
||||
|
@ -275,16 +265,4 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
|
|||
controlType = type;
|
||||
MekanismUtils.saveChunk(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEmitPowerFrom(ForgeDirection side)
|
||||
{
|
||||
return getOutputtingSides().contains(side);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void reconfigure()
|
||||
{
|
||||
powerHandler.configure(0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ import universalelectricity.core.grid.IElectricityNetwork;
|
|||
import universalelectricity.prefab.tile.IRotatable;
|
||||
import universalelectricity.prefab.tile.TileEntityAdvanced;
|
||||
import universalelectricity.prefab.tile.TileEntityElectrical;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import cofh.api.energy.TileEnergyHandler;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
@ -195,13 +194,6 @@ public class TileEntityMultimeter extends TileEntityAdvanced implements ITileNet
|
|||
{
|
||||
return ((TileEnergyHandler) tileEntity).getEnergyStored(side.getOpposite());
|
||||
}
|
||||
else if (tileEntity instanceof IPowerReceptor)
|
||||
{
|
||||
if (((IPowerReceptor) tileEntity).getPowerReceiver(side) != null)
|
||||
{
|
||||
return ((IPowerReceptor) tileEntity).getPowerReceiver(side).getEnergyStored();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -10,12 +10,10 @@ import mekanism.induction.common.wire.IWireMaterial;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.compatibility.Compatibility;
|
||||
import universalelectricity.compatibility.TileEntityUniversalConductor;
|
||||
import universalelectricity.core.block.INetworkProvider;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.core.vector.VectorHelper;
|
||||
import buildcraft.api.power.PowerHandler;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
|
@ -169,16 +167,7 @@ public class TileEntityWire extends TileEntityUniversalConductor implements ITil
|
|||
nbt.setInteger("dyeID", dyeID);
|
||||
nbt.setBoolean("isInsulated", isInsulated);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doWork(PowerHandler workProvider)
|
||||
{
|
||||
buildcraftBuffer = Compatibility.BC3_RATIO * 25 * getMaterial().maxAmps;
|
||||
powerHandler.configure(0, buildcraftBuffer, buildcraftBuffer, buildcraftBuffer * 2);
|
||||
|
||||
super.doWork(workProvider);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isInsulated()
|
||||
{
|
||||
|
|
|
@ -4,36 +4,18 @@ import ic2.api.energy.event.EnergyTileLoadEvent;
|
|||
import ic2.api.energy.event.EnergyTileUnloadEvent;
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
import ic2.api.energy.tile.IEnergyTile;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import universalelectricity.compatibility.Compatibility;
|
||||
import universalelectricity.core.electricity.ElectricityPack;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.core.vector.VectorHelper;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.api.power.PowerHandler;
|
||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
import buildcraft.api.power.PowerHandler.Type;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
|
||||
public abstract class PartUniversalConductor extends PartConductor implements IEnergySink, IPowerReceptor, IEnergyHandler
|
||||
public abstract class PartUniversalConductor extends PartConductor implements IEnergySink, IEnergyHandler
|
||||
{
|
||||
protected boolean isAddedToEnergyNet;
|
||||
public PowerHandler powerHandler;
|
||||
public float buildcraftBuffer = Compatibility.BC3_RATIO * 50;
|
||||
|
||||
public PartUniversalConductor()
|
||||
{
|
||||
powerHandler = new PowerHandler(this, Type.PIPE);
|
||||
powerHandler.configure(0, buildcraftBuffer, buildcraftBuffer, buildcraftBuffer * 2);
|
||||
powerHandler.configurePowerPerdition(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidAcceptor(TileEntity tile)
|
||||
|
@ -42,10 +24,6 @@ public abstract class PartUniversalConductor extends PartConductor implements IE
|
|||
{
|
||||
return true;
|
||||
}
|
||||
else if(tile instanceof IPowerReceptor)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if(tile instanceof IEnergyHandler)
|
||||
{
|
||||
return true;
|
||||
|
@ -185,37 +163,6 @@ public abstract class PartUniversalConductor extends PartConductor implements IE
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* BuildCraft functions
|
||||
*/
|
||||
@Override
|
||||
public PowerReceiver getPowerReceiver(ForgeDirection side)
|
||||
{
|
||||
return powerHandler.getPowerReceiver();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doWork(PowerHandler workProvider)
|
||||
{
|
||||
Set<TileEntity> ignoreTiles = new HashSet<TileEntity>();
|
||||
ignoreTiles.add(tile());
|
||||
|
||||
for(ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
TileEntity tile = new Vector3(tile()).modifyPositionFromSide(direction).getTileEntity(world());
|
||||
ignoreTiles.add(tile);
|
||||
}
|
||||
|
||||
ElectricityPack pack = ElectricityPack.getFromWatts(workProvider.useEnergy(0, getNetwork().getRequest(tile()).getWatts() * Compatibility.TO_BC_RATIO, true) * Compatibility.BC3_RATIO, 120);
|
||||
getNetwork().produce(pack, ignoreTiles.toArray(new TileEntity[0]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld()
|
||||
{
|
||||
return world();
|
||||
}
|
||||
|
||||
/**
|
||||
* Thermal Expansion Functions
|
||||
*/
|
||||
|
|
|
@ -22,8 +22,6 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.compatibility.Compatibility;
|
||||
import buildcraft.api.power.PowerHandler;
|
||||
import codechicken.lib.data.MCDataInput;
|
||||
import codechicken.lib.data.MCDataOutput;
|
||||
import codechicken.lib.lighting.LazyLightMatrix;
|
||||
|
@ -186,15 +184,6 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN
|
|||
material = EnumWireMaterial.values()[id];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doWork(PowerHandler workProvider)
|
||||
{
|
||||
buildcraftBuffer = Compatibility.BC3_RATIO * 25 * Math.min(getMaterial().maxAmps, 100);
|
||||
powerHandler.configure(0, buildcraftBuffer, buildcraftBuffer, buildcraftBuffer * 2);
|
||||
|
||||
super.doWork(workProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue