mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-26 15:03:07 +00:00
#1390 #1393 EIO machines and generators now implement only IEnergyReciver or IEnergyProvider instead of IEnergyHandler where appropriate
This commit is contained in:
1 parent
b6bee1a3fb
commit
26c8cf6c76
26 files changed
+134
-109
No files matched your search
@@ -18,14 +18,15 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.geom.Offset;
|
||||
import crazypants.enderio.power.IInternalPowerReceptor;
|
||||
import crazypants.enderio.power.IInternalPowerHandler;
|
||||
import crazypants.util.BlockCoord;
|
||||
|
||||
@Interface(iface = "appeng.api.networking.IGridHost", modid = "appliedenergistics2")
|
||||
public interface IConduitBundle extends IInternalPowerReceptor, IFluidHandler, IItemDuct, IGasHandler, IGridHost {
|
||||
public interface IConduitBundle extends IInternalPowerHandler, IFluidHandler, IItemDuct, IGasHandler, IGridHost {
|
||||
|
||||
TileEntity getEntity();
|
||||
|
||||
@Override
|
||||
BlockCoord getLocation();
|
||||
|
||||
// conduits
|
||||
|
||||
@@ -5,10 +5,10 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.IExtractor;
|
||||
import crazypants.enderio.power.ICapacitor;
|
||||
import crazypants.enderio.power.IInternalPowerReceptor;
|
||||
import crazypants.enderio.power.IInternalPowerHandler;
|
||||
import crazypants.enderio.power.IPowerInterface;
|
||||
|
||||
public interface IPowerConduit extends IConduit, IInternalPowerReceptor, IExtractor {
|
||||
public interface IPowerConduit extends IConduit, IInternalPowerHandler, IExtractor {
|
||||
|
||||
public static final String ICON_KEY = "enderio:powerConduit";
|
||||
public static final String ICON_KEY_INPUT = "enderio:powerConduitInput";
|
||||
@@ -24,6 +24,7 @@ public interface IPowerConduit extends IConduit, IInternalPowerReceptor, IExtrac
|
||||
|
||||
int getMaxEnergyExtracted(ForgeDirection dir);
|
||||
|
||||
@Override
|
||||
int getMaxEnergyRecieved(ForgeDirection dir);
|
||||
|
||||
IIcon getTextureForInputMode();
|
||||
|
||||
@@ -24,8 +24,9 @@ import crazypants.enderio.conduit.power.NetworkPowerManager;
|
||||
import crazypants.enderio.conduit.power.PowerConduitNetwork;
|
||||
import crazypants.enderio.conduit.power.PowerTracker;
|
||||
import crazypants.enderio.machine.power.PowerDisplayUtil;
|
||||
import crazypants.enderio.power.IInternalPowerReceptor;
|
||||
import crazypants.enderio.power.EnergyHandlerPI;
|
||||
import crazypants.enderio.power.IInternalPowerReceiver;
|
||||
import crazypants.enderio.power.IInternalPoweredTile;
|
||||
import crazypants.util.Lang;
|
||||
|
||||
public class PacketConduitProbe implements IMessage, IMessageHandler<PacketConduitProbe, IMessage> {
|
||||
@@ -57,7 +58,7 @@ public class PacketConduitProbe implements IMessage, IMessageHandler<PacketCondu
|
||||
TileConduitBundle tcb = (TileConduitBundle) te;
|
||||
return tcb.getConduit(IPowerConduit.class) != null || tcb.getConduit(IItemConduit.class) != null;
|
||||
}
|
||||
if(te instanceof IInternalPowerReceptor) {
|
||||
if(te instanceof IInternalPoweredTile) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -117,9 +118,9 @@ public class PacketConduitProbe implements IMessage, IMessageHandler<PacketCondu
|
||||
|
||||
sendInfoMessage(player, (TileConduitBundle) te);
|
||||
|
||||
} else if(te instanceof IInternalPowerReceptor) {
|
||||
IInternalPowerReceptor pr = (IInternalPowerReceptor) te;
|
||||
sendPowerReciptorInfo(player, block, pr.getEnergyStored(null), pr.getMaxEnergyStored(null), 0,
|
||||
} else if(te instanceof IInternalPowerReceiver) {
|
||||
IInternalPowerReceiver pr = (IInternalPowerReceiver) te;
|
||||
sendPowerReciptorInfo(player, block, pr.getEnergyStored(), pr.getMaxEnergyStored(), 0,
|
||||
0, EnergyHandlerPI.getPowerRequest(ForgeDirection.NORTH, pr));
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.enderio.power.Capacitors;
|
||||
import crazypants.enderio.power.ICapacitor;
|
||||
import crazypants.enderio.power.IInternalPowerReceptor;
|
||||
import crazypants.enderio.power.IInternalPoweredTile;
|
||||
import crazypants.enderio.power.PowerHandlerUtil;
|
||||
import crazypants.util.BlockCoord;
|
||||
import crazypants.util.InventoryWrapper;
|
||||
@@ -33,7 +33,7 @@ import crazypants.util.ItemUtil;
|
||||
import crazypants.util.Lang;
|
||||
import crazypants.vecmath.VecmathUtil;
|
||||
|
||||
public abstract class AbstractMachineEntity extends TileEntityEio implements ISidedInventory, IInternalPowerReceptor, IMachine, IRedstoneModeControlable,
|
||||
public abstract class AbstractMachineEntity extends TileEntityEio implements ISidedInventory, IInternalPoweredTile, IMachine, IRedstoneModeControlable,
|
||||
IIoConfigurable {
|
||||
|
||||
public short facing;
|
||||
@@ -291,34 +291,11 @@ public abstract class AbstractMachineEntity extends TileEntityEio implements ISi
|
||||
|
||||
// RF API Power
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
|
||||
if(isSideDisabled(from.ordinal())) {
|
||||
return 0;
|
||||
}
|
||||
return PowerHandlerUtil.recieveInternal(this, maxReceive,from, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from) {
|
||||
return !isSideDisabled(from.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from) {
|
||||
return getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from) {
|
||||
return getMaxEnergyStored();
|
||||
}
|
||||
|
||||
// --- Process Loop
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -9,8 +9,10 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import crazypants.enderio.machine.IMachineRecipe.ResultStack;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.enderio.power.IInternalPowerReceiver;
|
||||
import crazypants.enderio.power.PowerHandlerUtil;
|
||||
|
||||
public abstract class AbstractPoweredTaskEntity extends AbstractMachineEntity {
|
||||
public abstract class AbstractPoweredTaskEntity extends AbstractMachineEntity implements IInternalPowerReceiver {
|
||||
|
||||
protected IPoweredTask currentTask = null;
|
||||
protected IMachineRecipe lastCompletedRecipe;
|
||||
@@ -69,6 +71,26 @@ public abstract class AbstractPoweredTaskEntity extends AbstractMachineEntity {
|
||||
return currentTask == null ? 0 : currentTask.getProgress();
|
||||
}
|
||||
|
||||
//RF API Power
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
|
||||
if(isSideDisabled(from.ordinal())) {
|
||||
return 0;
|
||||
}
|
||||
return PowerHandlerUtil.recieveInternal(this, maxReceive, from, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from) {
|
||||
return getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from) {
|
||||
return getMaxEnergyStored();
|
||||
}
|
||||
|
||||
public IPoweredTask getCurrentTask() {
|
||||
return currentTask;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ import crazypants.enderio.machine.capbank.network.InventoryImpl;
|
||||
import crazypants.enderio.machine.capbank.network.NetworkUtil;
|
||||
import crazypants.enderio.machine.capbank.packet.PacketNetworkIdRequest;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.enderio.power.IInternalPowerReceptor;
|
||||
import crazypants.enderio.power.IInternalPowerHandler;
|
||||
import crazypants.enderio.power.IPowerInterface;
|
||||
import crazypants.enderio.power.IPowerStorage;
|
||||
import crazypants.enderio.power.PowerHandlerUtil;
|
||||
@@ -42,7 +42,7 @@ import crazypants.util.EntityUtil;
|
||||
import crazypants.util.Util;
|
||||
import crazypants.vecmath.Vector3d;
|
||||
|
||||
public class TileCapBank extends TileEntityEio implements IInternalPowerReceptor, IInventory, IIoConfigurable, IPowerStorage {
|
||||
public class TileCapBank extends TileEntityEio implements IInternalPowerHandler, IInventory, IIoConfigurable, IPowerStorage {
|
||||
|
||||
private Map<ForgeDirection, IoMode> faceModes;
|
||||
private Map<ForgeDirection, InfoDisplayType> faceDisplayTypes;
|
||||
|
||||
@@ -348,13 +348,12 @@ public class CapBankNetwork implements ICapBankNetwork {
|
||||
spaceAvailable = Integer.MAX_VALUE;
|
||||
}
|
||||
int res = Math.min(maxReceive, (int) spaceAvailable);
|
||||
res = Math.min(maxReceive, getMaxInput());
|
||||
res = Math.min(res, getMaxInput());
|
||||
if(!simulate) {
|
||||
if(!type.isCreative()) {
|
||||
addEnergy(res);
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package crazypants.enderio.machine.generator;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import crazypants.enderio.machine.AbstractMachineEntity;
|
||||
import crazypants.enderio.machine.SlotDefinition;
|
||||
import crazypants.enderio.power.IInternalPowerProvider;
|
||||
|
||||
public abstract class AbstractGeneratorEntity extends AbstractMachineEntity implements IInternalPowerProvider {
|
||||
|
||||
//RF API Power
|
||||
|
||||
public AbstractGeneratorEntity(SlotDefinition slotDefinition) {
|
||||
super(slotDefinition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from) {
|
||||
return getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from) {
|
||||
return getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
+4
-9
@@ -11,18 +11,18 @@ import net.minecraftforge.fluids.FluidTank;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.fluid.FluidFuelRegister;
|
||||
import crazypants.enderio.fluid.IFluidCoolant;
|
||||
import crazypants.enderio.fluid.IFluidFuel;
|
||||
import crazypants.enderio.fluid.FluidFuelRegister;
|
||||
import crazypants.enderio.machine.AbstractMachineEntity;
|
||||
import crazypants.enderio.machine.IoMode;
|
||||
import crazypants.enderio.machine.SlotDefinition;
|
||||
import crazypants.enderio.machine.generator.AbstractGeneratorEntity;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.enderio.power.PowerDistributor;
|
||||
import crazypants.util.BlockCoord;
|
||||
import crazypants.util.FluidUtil;
|
||||
|
||||
public class TileCombustionGenerator extends AbstractMachineEntity implements IFluidHandler {
|
||||
public class TileCombustionGenerator extends AbstractGeneratorEntity implements IFluidHandler {
|
||||
|
||||
private final FluidTank coolantTank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME * 5);
|
||||
private final FluidTank fuelTank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME * 5);
|
||||
@@ -162,7 +162,7 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IF
|
||||
int lastGenerated = generated;
|
||||
|
||||
boolean isActive = generateEnergy();
|
||||
if(isActive != this.active) {
|
||||
if(isActive != active) {
|
||||
active = isActive;
|
||||
res = true;
|
||||
}
|
||||
@@ -190,11 +190,6 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IF
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private boolean transmitEnergy() {
|
||||
if(getEnergyStored() <= 0) {
|
||||
return false;
|
||||
|
||||
+3
-9
@@ -6,17 +6,16 @@ import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.machine.AbstractMachineEntity;
|
||||
import crazypants.enderio.machine.SlotDefinition;
|
||||
import crazypants.enderio.machine.generator.AbstractGeneratorEntity;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.enderio.power.Capacitors;
|
||||
import crazypants.enderio.power.PowerDistributor;
|
||||
import crazypants.util.BlockCoord;
|
||||
|
||||
public class TileEntityStirlingGenerator extends AbstractMachineEntity implements ISidedInventory {
|
||||
public class TileEntityStirlingGenerator extends AbstractGeneratorEntity implements ISidedInventory {
|
||||
|
||||
public static final int ENERGY_PER_TICK = Config.stirlingGeneratorBaseRfPerTick;
|
||||
|
||||
@@ -43,11 +42,6 @@ public class TileEntityStirlingGenerator extends AbstractMachineEntity implement
|
||||
return "Stirling Generator";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMachineItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return TileEntityFurnace.isItemFuel(itemstack);
|
||||
@@ -110,7 +104,7 @@ public class TileEntityStirlingGenerator extends AbstractMachineEntity implement
|
||||
|
||||
@Override
|
||||
public int getPowerUsePerTick() {
|
||||
return (int)Math.round(ENERGY_PER_TICK * getEnergyMultiplier());
|
||||
return Math.round(ENERGY_PER_TICK * getEnergyMultiplier());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package crazypants.enderio.machine.generator.zombie;
|
||||
|
||||
import scala.xml.persistent.SetStorage;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -13,15 +12,15 @@ import net.minecraftforge.fluids.IFluidHandler;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.machine.AbstractMachineEntity;
|
||||
import crazypants.enderio.machine.IoMode;
|
||||
import crazypants.enderio.machine.SlotDefinition;
|
||||
import crazypants.enderio.machine.generator.AbstractGeneratorEntity;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.enderio.power.PowerDistributor;
|
||||
import crazypants.util.BlockCoord;
|
||||
import crazypants.util.FluidUtil;
|
||||
|
||||
public class TileZombieGenerator extends AbstractMachineEntity implements IFluidHandler {
|
||||
public class TileZombieGenerator extends AbstractGeneratorEntity implements IFluidHandler {
|
||||
|
||||
private static int IO_MB_TICK = 250;
|
||||
|
||||
@@ -46,12 +45,6 @@ public class TileZombieGenerator extends AbstractMachineEntity implements IFluid
|
||||
return ModObject.blockZombieGenerator.unlocalisedName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsMode(ForgeDirection faceHit, IoMode mode) {
|
||||
@@ -129,7 +122,7 @@ public class TileZombieGenerator extends AbstractMachineEntity implements IFluid
|
||||
} else {
|
||||
|
||||
boolean isActive = generateEnergy();
|
||||
if(isActive != this.active) {
|
||||
if(isActive != active) {
|
||||
active = isActive;
|
||||
res = true;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.machine.IRedstoneModeControlable;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.enderio.power.BasicCapacitor;
|
||||
import crazypants.enderio.power.IInternalPowerReceptor;
|
||||
import crazypants.enderio.power.IInternalPowerHandler;
|
||||
import crazypants.enderio.power.IPowerInterface;
|
||||
import crazypants.enderio.power.PowerHandlerUtil;
|
||||
import crazypants.util.BlockCoord;
|
||||
@@ -33,7 +33,7 @@ import crazypants.util.ItemUtil;
|
||||
import crazypants.util.Lang;
|
||||
import crazypants.vecmath.VecmathUtil;
|
||||
|
||||
public class TileHyperCube extends TileEntityEio implements IInternalPowerReceptor, IFluidHandler, ISidedInventory, IRedstoneModeControlable {
|
||||
public class TileHyperCube extends TileEntityEio implements IInternalPowerHandler, IFluidHandler, ISidedInventory, IRedstoneModeControlable {
|
||||
|
||||
private static final double ENERGY_LOSS = Config.transceiverEnergyLoss;
|
||||
|
||||
|
||||
@@ -17,13 +17,13 @@ import crazypants.enderio.machine.wireless.WirelessChargerController;
|
||||
import crazypants.enderio.power.BasicCapacitor;
|
||||
import crazypants.enderio.power.Capacitors;
|
||||
import crazypants.enderio.power.ICapacitor;
|
||||
import crazypants.enderio.power.IInternalPowerReceptor;
|
||||
import crazypants.enderio.power.IInternalPowerReceiver;
|
||||
import crazypants.enderio.power.PowerHandlerUtil;
|
||||
import crazypants.util.BlockCoord;
|
||||
import crazypants.util.ForgeDirectionOffsets;
|
||||
import crazypants.vecmath.Vector3d;
|
||||
|
||||
public class TileElectricLight extends TileEntityEio implements IInternalPowerReceptor {
|
||||
public class TileElectricLight extends TileEntityEio implements IInternalPowerReceiver {
|
||||
|
||||
private ForgeDirection face = ForgeDirection.DOWN;
|
||||
|
||||
@@ -446,11 +446,6 @@ public class TileElectricLight extends TileEntityEio implements IInternalPowerRe
|
||||
return PowerHandlerUtil.recieveInternal(this, maxReceive, from, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from) {
|
||||
if(!requiresPower) {
|
||||
|
||||
@@ -16,10 +16,10 @@ import crazypants.enderio.machine.AbstractMachineEntity;
|
||||
import crazypants.enderio.machine.IoMode;
|
||||
import crazypants.enderio.machine.SlotDefinition;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.enderio.power.IInternalPowerReceptor;
|
||||
import crazypants.enderio.power.IInternalPoweredTile;
|
||||
import crazypants.util.DyeColor;
|
||||
|
||||
public class TilePowerMonitor extends AbstractMachineEntity implements IInternalPowerReceptor {
|
||||
public class TilePowerMonitor extends AbstractMachineEntity implements IInternalPoweredTile {
|
||||
|
||||
int energyPerTick = 1;
|
||||
|
||||
|
||||
@@ -28,7 +28,8 @@ import crazypants.enderio.machine.IoMode;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.enderio.power.BasicCapacitor;
|
||||
import crazypants.enderio.power.IInternalPowerReceptor;
|
||||
import crazypants.enderio.power.IInternalPowerHandler;
|
||||
import crazypants.enderio.power.IInternalPoweredTile;
|
||||
import crazypants.enderio.power.IPowerInterface;
|
||||
import crazypants.enderio.power.IPowerStorage;
|
||||
import crazypants.enderio.power.PowerHandlerUtil;
|
||||
@@ -36,7 +37,7 @@ import crazypants.util.BlockCoord;
|
||||
import crazypants.util.Util;
|
||||
import crazypants.vecmath.VecmathUtil;
|
||||
|
||||
public class TileCapacitorBank extends TileEntityEio implements IInternalPowerReceptor, IInventory, IIoConfigurable, IPowerStorage {
|
||||
public class TileCapacitorBank extends TileEntityEio implements IInternalPowerHandler, IInventory, IIoConfigurable, IPowerStorage {
|
||||
|
||||
static final BasicCapacitor BASE_CAP = new BasicCapacitor(Config.capacitorBankMaxIoRF, Config.capacitorBankMaxStorageRF);
|
||||
|
||||
@@ -438,7 +439,7 @@ public class TileCapacitorBank extends TileEntityEio implements IInternalPowerRe
|
||||
}
|
||||
Receptor r = new Receptor(ph, dir, mode);
|
||||
localReceptors.add(r);
|
||||
if(mode == IoMode.NONE && !(ph.getDelegate() instanceof IInternalPowerReceptor)) {
|
||||
if(mode == IoMode.NONE && !(ph.getDelegate() instanceof IInternalPoweredTile)) {
|
||||
setIoMode(dir, IoMode.PULL, false);
|
||||
r.mode = IoMode.PULL;
|
||||
render = true;
|
||||
|
||||
@@ -15,12 +15,12 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.power.BasicCapacitor;
|
||||
import crazypants.enderio.power.IInternalPowerReceptor;
|
||||
import crazypants.enderio.power.IInternalPowerProvider;
|
||||
import crazypants.enderio.power.IPowerInterface;
|
||||
import crazypants.enderio.power.PowerHandlerUtil;
|
||||
import crazypants.util.BlockCoord;
|
||||
|
||||
public class TileEntitySolarPanel extends TileEntity implements IInternalPowerReceptor {
|
||||
public class TileEntitySolarPanel extends TileEntity implements IInternalPowerProvider {
|
||||
|
||||
private BasicCapacitor capacitor;
|
||||
|
||||
@@ -52,11 +52,6 @@ public class TileEntitySolarPanel extends TileEntity implements IInternalPowerRe
|
||||
|
||||
// RF Power
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
|
||||
return PowerHandlerUtil.recieveInternal(this, maxReceive, from, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) {
|
||||
return 0;
|
||||
|
||||
@@ -7,11 +7,11 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import crazypants.enderio.TileEntityEio;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.enderio.power.IInternalPowerReceptor;
|
||||
import crazypants.enderio.power.IInternalPowerReceiver;
|
||||
import crazypants.enderio.power.PowerHandlerUtil;
|
||||
import crazypants.util.BlockCoord;
|
||||
|
||||
public class TileWirelessCharger extends TileEntityEio implements IInternalPowerReceptor, IWirelessCharger {
|
||||
public class TileWirelessCharger extends TileEntityEio implements IInternalPowerReceiver, IWirelessCharger {
|
||||
|
||||
public static final int MAX_ENERGY_STORED = 200000;
|
||||
public static final int MAX_ENERGY_IN = 10000;
|
||||
@@ -123,11 +123,6 @@ public class TileWirelessCharger extends TileEntityEio implements IInternalPower
|
||||
return PowerHandlerUtil.recieveInternal(this, maxReceive, from, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int takeEnergy(int max) {
|
||||
int prev = storedEnergyRF;
|
||||
|
||||
@@ -15,4 +15,9 @@ public class EnergyHandlerPI extends EnergyReceiverPI {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOutputOnly() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package crazypants.enderio.power;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
|
||||
public class EnergyReceiverPI implements IPowerInterface {
|
||||
@@ -49,7 +48,7 @@ public class EnergyReceiverPI implements IPowerInterface {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int getPowerRequest(ForgeDirection dir, IEnergyHandler handler) {
|
||||
public static int getPowerRequest(ForgeDirection dir, IEnergyReceiver handler) {
|
||||
if(handler != null && dir != null && handler.canConnectEnergy(dir)) {
|
||||
return handler.receiveEnergy(dir, 99999999, true);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package crazypants.enderio.power;
|
||||
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
|
||||
public interface IInternalPowerHandler extends IInternalPoweredTile, IEnergyHandler {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package crazypants.enderio.power;
|
||||
|
||||
import cofh.api.energy.IEnergyProvider;
|
||||
|
||||
public interface IInternalPowerProvider extends IInternalPoweredTile, IEnergyProvider {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package crazypants.enderio.power;
|
||||
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
|
||||
public interface IInternalPowerReceiver extends IInternalPoweredTile, IEnergyReceiver {
|
||||
|
||||
}
|
||||
+3
-8
@@ -1,20 +1,15 @@
|
||||
package crazypants.enderio.power;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import cofh.api.energy.IEnergyConnection;
|
||||
|
||||
public interface IInternalPowerReceptor extends IEnergyHandler, IPowerContainer {
|
||||
//IEnergyHandler,
|
||||
public interface IInternalPoweredTile extends IPowerContainer, IEnergyConnection {
|
||||
|
||||
int getMaxEnergyRecieved(ForgeDirection dir);
|
||||
|
||||
@Override
|
||||
int getEnergyStored();
|
||||
|
||||
int getMaxEnergyStored();
|
||||
|
||||
@Override
|
||||
void setEnergyStored(int stored);
|
||||
|
||||
/**
|
||||
* Should the power be displayed in WAILA or other places
|
||||
*/
|
||||
@@ -46,7 +46,7 @@ public class PowerHandlerUtil {
|
||||
}
|
||||
|
||||
|
||||
public static int recieveInternal(IInternalPowerReceptor target, int maxReceive, ForgeDirection from, boolean simulate) {
|
||||
public static int recieveInternal(IInternalPoweredTile target, int maxReceive, ForgeDirection from, boolean simulate) {
|
||||
int result = Math.min(target.getMaxEnergyRecieved(from), maxReceive);
|
||||
result = Math.min(target.getMaxEnergyStored() - target.getEnergyStored(), result);
|
||||
if(result > 0 && !simulate) {
|
||||
|
||||
@@ -37,7 +37,7 @@ import crazypants.enderio.machine.IIoConfigurable;
|
||||
import crazypants.enderio.machine.IoMode;
|
||||
import crazypants.enderio.machine.capbank.TileCapBank;
|
||||
import crazypants.enderio.machine.power.TileCapacitorBank;
|
||||
import crazypants.enderio.power.IInternalPowerReceptor;
|
||||
import crazypants.enderio.power.IInternalPoweredTile;
|
||||
import crazypants.util.Lang;
|
||||
|
||||
public class WailaCompat implements IWailaDataProvider {
|
||||
@@ -154,8 +154,8 @@ public class WailaCompat implements IWailaDataProvider {
|
||||
}
|
||||
}
|
||||
|
||||
if(te instanceof IInternalPowerReceptor && accessor.getNBTData().hasKey("storedEnergyRF") && !(te instanceof TileCapBank)) {
|
||||
IInternalPowerReceptor power = (IInternalPowerReceptor) te;
|
||||
if(te instanceof IInternalPoweredTile && accessor.getNBTData().hasKey("storedEnergyRF") && !(te instanceof TileCapBank)) {
|
||||
IInternalPoweredTile power = (IInternalPoweredTile) te;
|
||||
|
||||
if(power.displayPower()) {
|
||||
|
||||
|
||||
Reference in new issue
Block a user