mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
more energy control compat stuff
This commit is contained in:
parent
ca2505dad0
commit
675838eec7
@ -1,9 +1,6 @@
|
||||
package api.hbm.tile;
|
||||
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
/**
|
||||
* Info providers for ENERGY CONTROL
|
||||
@ -18,84 +15,6 @@ import net.minecraft.util.StatCollector;
|
||||
* */
|
||||
public interface IInfoProviderEC {
|
||||
|
||||
/** The meat of the interface and the only method that should be called from externally, returns
|
||||
* an NBTTagCompound with all relevant data in EC's accepted format, the implementor takes care of
|
||||
* collecting and adding the data. */
|
||||
public NBTTagCompound provideInfo();
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* INTERNAL USE ONLY - HELPER METHODS BELOW
|
||||
*/
|
||||
|
||||
/** Instantiates the NBTTagCompound and adds common identifiers needed for NTM machines (e.g. HE as the energy type) */
|
||||
public default NBTTagCompound setup() {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString(KEY_EUTYPE, "HE");
|
||||
return data;
|
||||
}
|
||||
|
||||
/** Adds the tank to the NBTTagCompound using the supplied String as the key. */
|
||||
public default void addTank(String name, NBTTagCompound tag, FluidTank tank) {
|
||||
if(tank.getFill() == 0) {
|
||||
tag.setString(name, "N/A");
|
||||
} else {
|
||||
tag.setString(name, String.format("%s: %s mB", StatCollector.translateToLocal(tank.getTankType().getConditionalName()), tank.getFill()));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* [DATA TYPE] _ [NAME] _ [UNIT]
|
||||
*/
|
||||
|
||||
public static final String KEY_EUTYPE = "euType";
|
||||
|
||||
public static final String L_ENERGY_HE = "energy";
|
||||
public static final String L_ENERGY_TU = "energyTU";
|
||||
public static final String L_ENERGY_ = "energy_"; // Blast Furnace fuel
|
||||
|
||||
public static final String L_CAPACITY_HE = "capacity";
|
||||
public static final String L_CAPACITY_TU = "capacityTU";
|
||||
public static final String L_CAPACITY_ = "capacity_"; // Blast Furnace fuel capacity
|
||||
|
||||
public static final String D_CONSUMPTION_HE = "consumptionHE";
|
||||
public static final String D_CONSUMPTION_MB = "consumption";
|
||||
@Deprecated public static final String S_CONSUMPTION_ = "consumption_"; // FWatz fluid consumption rates
|
||||
|
||||
public static final String D_OUTPUT_HE = "output";
|
||||
public static final String D_OUTPUT_MB = "outputmb";
|
||||
public static final String D_OUTPUT_TU = "outputTU";
|
||||
|
||||
public static final String L_DIFF_HE = "diff"; // Battery diff per tick
|
||||
@Deprecated public static final String I_TEMP_K = "temp"; // Unused?
|
||||
public static final String D_TURBINE_PERCENT = "turbine"; // CCGT slider
|
||||
public static final String I_TURBINE_SPEED = "speed"; // CCGT RPM
|
||||
public static final String L_COREHEAT_C = "core"; // Research Reactor core heat
|
||||
public static final String L_HULLHEAT_C = "hull"; // Research Reactor hull heat
|
||||
public static final String S_LEVEL_PERCENT = "level"; // Research Reactor rods
|
||||
@Deprecated public static final String L_HEATL = "heatL"; // AMS and old Watz heat values
|
||||
public static final String D_HEAT_C = "heat"; // Research Reactor and RBMK column heat
|
||||
public static final String L_PRESSURE_BAR = "bar"; // ZIRNOX pressure
|
||||
public static final String I_FUEL = "fuel"; // RTG Blast Furnace heat
|
||||
@Deprecated public static final String S_FUELTEXT = "fuelText"; // Large Nuclear Reactor only
|
||||
@Deprecated public static final String S_DEPLETED = "depleted"; // Large Nuclear Reactor only
|
||||
public static final String D_DEPLETION_PERCENT = "depletion"; // RBMK Fuel depletion
|
||||
public static final String D_XENON_PERCENT = "xenon"; // RBMK Fuel xenon poisoning
|
||||
public static final String D_SKIN_C = "skin"; // RBMK Fuel skin heat
|
||||
public static final String D_CORE_C = "c_heat"; // RBMK Fuel core heat
|
||||
public static final String D_MELT_C = "melt"; // RBMK Fuel melting point
|
||||
public static final String I_PROGRESS = "progress";
|
||||
public static final String I_FLUX = "flux"; // Research and Breeding Reactor flux
|
||||
public static final String I_WATER = "water"; // Research Reactor water gauge
|
||||
public static final String L_DURABILITY = "durability"; // DFC Stabilizer Lens
|
||||
public static final String S_TANK = "tank";
|
||||
public static final String S_TANK2 = "tank2";
|
||||
public static final String S_TANK3 = "tank3";
|
||||
public static final String S_TANK4 = "tank4";
|
||||
public static final String S_TANK5 = "tank5";
|
||||
@Deprecated public static final String I_PISTONS = "pistons"; // Radial Performance Engine piston count
|
||||
public static final String S_CHUNKRAD = "chunkRad"; // Geiger Counter
|
||||
public static final String B_ACTIVE = "active";
|
||||
/** Adds any custom data that isn't covered by the standard energy and fluid implementations. */
|
||||
public void provideExtraInfo(NBTTagCompound data);
|
||||
}
|
||||
|
||||
@ -20,11 +20,13 @@ import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.sound.AudioWrapper;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.energy.IEnergyGenerator;
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@ -39,7 +41,7 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityChungus extends TileEntityLoadedBase implements IFluidAcceptor, IFluidSource, IEnergyGenerator, INBTPacketReceiver, IFluidStandardTransceiver, SimpleComponent {
|
||||
public class TileEntityChungus extends TileEntityLoadedBase implements IFluidAcceptor, IFluidSource, IEnergyGenerator, INBTPacketReceiver, IFluidStandardTransceiver, SimpleComponent, IInfoProviderEC {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 100000000000L;
|
||||
@ -51,6 +53,7 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IFluidAcc
|
||||
public List<IFluidAcceptor> list2 = new ArrayList();
|
||||
|
||||
public FluidTank[] tanks;
|
||||
protected double[] info = new double[3];
|
||||
|
||||
private AudioWrapper audio;
|
||||
private float audioDesync;
|
||||
@ -69,6 +72,8 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IFluidAcc
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.info = new double[3];
|
||||
|
||||
boolean operational = false;
|
||||
FluidType in = tanks[0].getTankType();
|
||||
boolean valid = false;
|
||||
@ -83,6 +88,9 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IFluidAcc
|
||||
tanks[0].setFill(tanks[0].getFill() - ops * trait.amountReq);
|
||||
tanks[1].setFill(tanks[1].getFill() + ops * trait.amountProduced);
|
||||
this.power += (ops * trait.heatEnergy * eff);
|
||||
info[0] = ops * trait.amountReq;
|
||||
info[1] = ops * trait.amountProduced;
|
||||
info[2] = ops * trait.heatEnergy * eff;
|
||||
valid = true;
|
||||
operational = ops > 0;
|
||||
}
|
||||
@ -373,4 +381,12 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IFluidAcc
|
||||
public FluidTank[] getAllTanks() {
|
||||
return tanks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideExtraInfo(NBTTagCompound data) {
|
||||
data.setBoolean(CompatEnergyControl.B_ACTIVE, info[1] > 0);
|
||||
data.setDouble(CompatEnergyControl.D_CONSUMPTION_MB, info[0]);
|
||||
data.setDouble(CompatEnergyControl.D_OUTPUT_MB, info[1]);
|
||||
data.setDouble(CompatEnergyControl.D_OUTPUT_HE, info[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,8 +12,10 @@ import com.hbm.items.ModItems;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityMachinePolluting;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
|
||||
import api.hbm.fluid.IFluidStandardSender;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@ -27,7 +29,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityDiFurnace extends TileEntityMachinePolluting implements IFluidStandardSender, IGUIProvider {
|
||||
public class TileEntityDiFurnace extends TileEntityMachinePolluting implements IFluidStandardSender, IGUIProvider, IInfoProviderEC {
|
||||
|
||||
public int progress;
|
||||
public int fuel;
|
||||
@ -270,4 +272,11 @@ public class TileEntityDiFurnace extends TileEntityMachinePolluting implements I
|
||||
public FluidTank[] getSendingTanks() {
|
||||
return this.getSmokeTanks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideExtraInfo(NBTTagCompound data) {
|
||||
data.setLong(CompatEnergyControl.L_ENERGY_, this.fuel);
|
||||
data.setLong(CompatEnergyControl.L_CAPACITY_, this.maxFuel);
|
||||
data.setInteger(CompatEnergyControl.I_PROGRESS, this.progress);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,8 +7,10 @@ import com.hbm.inventory.recipes.BlastFurnaceRecipes;
|
||||
import com.hbm.items.machine.ItemRTGPellet;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
import com.hbm.util.RTGUtil;
|
||||
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@ -18,8 +20,8 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityDiFurnaceRTG extends TileEntityMachineBase implements IGUIProvider
|
||||
{
|
||||
public class TileEntityDiFurnaceRTG extends TileEntityMachineBase implements IGUIProvider, IInfoProviderEC {
|
||||
|
||||
public short progress;
|
||||
private short processSpeed = 0;
|
||||
// Edit as needed
|
||||
@ -219,4 +221,9 @@ public class TileEntityDiFurnaceRTG extends TileEntityMachineBase implements IGU
|
||||
return new GUIMachineDiFurnaceRTG(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideExtraInfo(NBTTagCompound data) {
|
||||
data.setLong(CompatEnergyControl.L_FUEL, this.getPower());
|
||||
data.setInteger(CompatEnergyControl.I_PROGRESS, this.progress);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,27 +3,33 @@ package com.hbm.tileentity.machine;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.radiation.ChunkRadiationManager;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
|
||||
import api.hbm.energy.IEnergyGenerator;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineAmgen extends TileEntityLoadedBase implements IEnergyGenerator {
|
||||
public class TileEntityMachineAmgen extends TileEntityLoadedBase implements IEnergyGenerator, IInfoProviderEC {
|
||||
|
||||
public long power;
|
||||
public long maxPower = 500;
|
||||
protected long output = 0;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.output = 0;
|
||||
|
||||
Block block = worldObj.getBlock(xCoord, yCoord, zCoord);
|
||||
|
||||
if(block == ModBlocks.machine_amgen) {
|
||||
float rad = ChunkRadiationManager.proxy.getRadiation(worldObj, xCoord, yCoord, zCoord);
|
||||
power += rad;
|
||||
this.output += rad;
|
||||
ChunkRadiationManager.proxy.decrementRad(worldObj, xCoord, yCoord, zCoord, 5F);
|
||||
|
||||
} else if(block == ModBlocks.machine_geo) {
|
||||
@ -31,6 +37,7 @@ public class TileEntityMachineAmgen extends TileEntityLoadedBase implements IEne
|
||||
this.checkGeoInteraction(xCoord, yCoord - 1, zCoord);
|
||||
}
|
||||
|
||||
this.power += this.output;
|
||||
if(power > maxPower)
|
||||
power = maxPower;
|
||||
|
||||
@ -44,21 +51,21 @@ public class TileEntityMachineAmgen extends TileEntityLoadedBase implements IEne
|
||||
Block b = worldObj.getBlock(x, y, z);
|
||||
|
||||
if(b == ModBlocks.geysir_water) {
|
||||
power += 75;
|
||||
this.output += 75;
|
||||
} else if(b == ModBlocks.geysir_chlorine) {
|
||||
power += 100;
|
||||
this.output += 100;
|
||||
} else if(b == ModBlocks.geysir_vapor) {
|
||||
power += 50;
|
||||
this.output += 50;
|
||||
} else if(b == ModBlocks.geysir_nether) {
|
||||
power += 500;
|
||||
this.output += 500;
|
||||
} else if(b == Blocks.lava) {
|
||||
power += 100;
|
||||
this.output += 100;
|
||||
|
||||
if(worldObj.rand.nextInt(6000) == 0) {
|
||||
worldObj.setBlock(xCoord, yCoord - 1, zCoord, Blocks.obsidian);
|
||||
}
|
||||
} else if(b == Blocks.flowing_lava) {
|
||||
power += 25;
|
||||
this.output += 25;
|
||||
|
||||
if(worldObj.rand.nextInt(3000) == 0) {
|
||||
worldObj.setBlock(xCoord, yCoord - 1, zCoord, Blocks.cobblestone);
|
||||
@ -80,4 +87,10 @@ public class TileEntityMachineAmgen extends TileEntityLoadedBase implements IEne
|
||||
public long getMaxPower() {
|
||||
return this.maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideExtraInfo(NBTTagCompound data) {
|
||||
data.setBoolean(CompatEnergyControl.B_ACTIVE, this.output > 0);
|
||||
data.setDouble(CompatEnergyControl.D_OUTPUT_HE, this.output);
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,8 +11,10 @@ import com.hbm.packet.AuxGaugePacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -26,7 +28,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityMachineArcFurnace extends TileEntityLoadedBase implements ISidedInventory, IEnergyUser, IGUIProvider {
|
||||
public class TileEntityMachineArcFurnace extends TileEntityLoadedBase implements ISidedInventory, IEnergyUser, IGUIProvider, IInfoProviderEC {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
@ -400,4 +402,10 @@ public class TileEntityMachineArcFurnace extends TileEntityLoadedBase implements
|
||||
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUIMachineArcFurnace(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideExtraInfo(NBTTagCompound data) {
|
||||
data.setBoolean(CompatEnergyControl.B_ACTIVE, this.hasPower() && this.canProcess());
|
||||
data.setInteger(CompatEnergyControl.I_PROGRESS, this.dualCookTime);
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,9 +15,11 @@ import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.IUpgradeInfoProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@ -30,7 +32,7 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityMachineCentrifuge extends TileEntityMachineBase implements IEnergyUser, IGUIProvider, IUpgradeInfoProvider {
|
||||
public class TileEntityMachineCentrifuge extends TileEntityMachineBase implements IEnergyUser, IGUIProvider, IUpgradeInfoProvider, IInfoProviderEC {
|
||||
|
||||
public int progress;
|
||||
public long power;
|
||||
@ -345,4 +347,10 @@ public class TileEntityMachineCentrifuge extends TileEntityMachineBase implement
|
||||
if(type == UpgradeType.OVERDRIVE) return 3;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideExtraInfo(NBTTagCompound data) {
|
||||
data.setBoolean(CompatEnergyControl.B_ACTIVE, this.progress > 0);
|
||||
data.setInteger(CompatEnergyControl.B_ACTIVE, this.progress);
|
||||
}
|
||||
}
|
||||
@ -24,10 +24,12 @@ import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.IConfigurableMachine;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachinePolluting;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energy.IEnergyGenerator;
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@ -38,7 +40,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineDiesel extends TileEntityMachinePolluting implements IEnergyGenerator, IFluidContainer, IFluidAcceptor, IFluidStandardTransceiver, IConfigurableMachine, IGUIProvider {
|
||||
public class TileEntityMachineDiesel extends TileEntityMachinePolluting implements IEnergyGenerator, IFluidContainer, IFluidAcceptor, IFluidStandardTransceiver, IConfigurableMachine, IGUIProvider, IInfoProviderEC {
|
||||
|
||||
public long power;
|
||||
public int soundCycle = 0;
|
||||
@ -326,4 +328,13 @@ public class TileEntityMachineDiesel extends TileEntityMachinePolluting implemen
|
||||
public FluidTank[] getSendingTanks() {
|
||||
return this.getSmokeTanks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideExtraInfo(NBTTagCompound data) {
|
||||
long he = getHEFromFuel(tank.getTankType());
|
||||
boolean active = tank.getFill() > 0 && he > 0;
|
||||
data.setBoolean(CompatEnergyControl.B_ACTIVE, active);
|
||||
data.setDouble(CompatEnergyControl.D_CONSUMPTION_MB, active ? 1D : 0D);
|
||||
data.setDouble(CompatEnergyControl.D_OUTPUT_HE, he);
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,9 +13,11 @@ import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.IUpgradeInfoProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@ -28,7 +30,7 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineEPress extends TileEntityMachineBase implements IEnergyUser, IGUIProvider, IUpgradeInfoProvider {
|
||||
public class TileEntityMachineEPress extends TileEntityMachineBase implements IEnergyUser, IGUIProvider, IUpgradeInfoProvider, IInfoProviderEC {
|
||||
|
||||
public long power = 0;
|
||||
public final static long maxPower = 50000;
|
||||
@ -281,4 +283,9 @@ public class TileEntityMachineEPress extends TileEntityMachineBase implements IE
|
||||
if(type == UpgradeType.SPEED) return 3;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideExtraInfo(NBTTagCompound data) {
|
||||
data.setInteger(CompatEnergyControl.I_PROGRESS, this.press);
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,11 +15,13 @@ import com.hbm.packet.LoopedSoundPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
import com.hbm.util.InventoryUtil;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.fluid.IFluidStandardReceiver;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -34,7 +36,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
//epic!
|
||||
public class TileEntityMachineGasCent extends TileEntityMachineBase implements IEnergyUser, IFluidStandardReceiver, IGUIProvider {
|
||||
public class TileEntityMachineGasCent extends TileEntityMachineBase implements IEnergyUser, IFluidStandardReceiver, IGUIProvider, IInfoProviderEC {
|
||||
|
||||
public long power;
|
||||
public int progress;
|
||||
@ -452,4 +454,10 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I
|
||||
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUIMachineGasCent(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideExtraInfo(NBTTagCompound data) {
|
||||
data.setBoolean(CompatEnergyControl.B_ACTIVE, this.progress > 0);
|
||||
data.setInteger(CompatEnergyControl.I_PROGRESS, this.progress);
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,10 +21,12 @@ import com.hbm.main.MainRegistry;
|
||||
import com.hbm.sound.AudioWrapper;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.energy.IEnergyGenerator;
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -42,13 +44,14 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityMachineLargeTurbine extends TileEntityMachineBase implements IFluidContainer, IFluidAcceptor, IFluidSource, IEnergyGenerator, IFluidStandardTransceiver, IGUIProvider, SimpleComponent {
|
||||
public class TileEntityMachineLargeTurbine extends TileEntityMachineBase implements IFluidContainer, IFluidAcceptor, IFluidSource, IEnergyGenerator, IFluidStandardTransceiver, IGUIProvider, SimpleComponent, IInfoProviderEC {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 100000000;
|
||||
public int age = 0;
|
||||
public List<IFluidAcceptor> list2 = new ArrayList();
|
||||
public FluidTank[] tanks;
|
||||
protected double[] info = new double[3];
|
||||
|
||||
private boolean shouldTurn;
|
||||
public float rotor;
|
||||
@ -79,9 +82,10 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.info = new double[3];
|
||||
|
||||
age++;
|
||||
if(age >= 2)
|
||||
{
|
||||
if(age >= 2) {
|
||||
age = 0;
|
||||
}
|
||||
|
||||
@ -112,6 +116,9 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
|
||||
tanks[0].setFill(tanks[0].getFill() - ops * trait.amountReq);
|
||||
tanks[1].setFill(tanks[1].getFill() + ops * trait.amountProduced);
|
||||
this.power += (ops * trait.heatEnergy * eff);
|
||||
info[0] = ops * trait.amountReq;
|
||||
info[1] = ops * trait.amountProduced;
|
||||
info[2] = ops * trait.heatEnergy * eff;
|
||||
valid = true;
|
||||
operational = ops > 0;
|
||||
}
|
||||
@ -377,4 +384,12 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
|
||||
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUIMachineLargeTurbine(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideExtraInfo(NBTTagCompound data) {
|
||||
data.setBoolean(CompatEnergyControl.B_ACTIVE, info[1] > 0);
|
||||
data.setDouble(CompatEnergyControl.D_CONSUMPTION_MB, info[0]);
|
||||
data.setDouble(CompatEnergyControl.D_OUTPUT_MB, info[1]);
|
||||
data.setDouble(CompatEnergyControl.D_OUTPUT_HE, info[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,11 +2,14 @@ package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
|
||||
import api.hbm.energy.IEnergyGenerator;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineMiniRTG extends TileEntityLoadedBase implements IEnergyGenerator {
|
||||
public class TileEntityMachineMiniRTG extends TileEntityLoadedBase implements IEnergyGenerator, IInfoProviderEC {
|
||||
|
||||
public long power;
|
||||
boolean tact = false;
|
||||
@ -16,10 +19,7 @@ public class TileEntityMachineMiniRTG extends TileEntityLoadedBase implements IE
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(this.getBlockType() == ModBlocks.machine_powerrtg)
|
||||
power += 2500;
|
||||
else
|
||||
power += 700;
|
||||
power += this.getOutput();
|
||||
|
||||
if(power > getMaxPower())
|
||||
power = getMaxPower();
|
||||
@ -28,15 +28,16 @@ public class TileEntityMachineMiniRTG extends TileEntityLoadedBase implements IE
|
||||
this.sendPower(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public long getOutput() {
|
||||
if(this.getBlockType() == ModBlocks.machine_powerrtg) return 2_500;
|
||||
return 700;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
|
||||
if(this.getBlockType() == ModBlocks.machine_powerrtg)
|
||||
return 50000;
|
||||
|
||||
return 1400;
|
||||
if(this.getBlockType() == ModBlocks.machine_powerrtg) return 50_000;
|
||||
return 1_400;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -48,4 +49,11 @@ public class TileEntityMachineMiniRTG extends TileEntityLoadedBase implements IE
|
||||
public void setPower(long i) {
|
||||
power = i;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void provideExtraInfo(NBTTagCompound data) {
|
||||
data.setBoolean(CompatEnergyControl.B_ACTIVE, true);
|
||||
data.setDouble(CompatEnergyControl.D_OUTPUT_HE, this.getOutput());
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,9 +8,11 @@ import com.hbm.packet.AuxElectricityPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
import com.hbm.util.RTGUtil;
|
||||
|
||||
import api.hbm.energy.IEnergyGenerator;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -24,7 +26,7 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineRTG extends TileEntityLoadedBase implements ISidedInventory, IEnergyGenerator, IGUIProvider {
|
||||
public class TileEntityMachineRTG extends TileEntityLoadedBase implements ISidedInventory, IEnergyGenerator, IGUIProvider, IInfoProviderEC {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
@ -249,4 +251,10 @@ public class TileEntityMachineRTG extends TileEntityLoadedBase implements ISided
|
||||
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUIMachineRTG(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideExtraInfo(NBTTagCompound data) {
|
||||
data.setBoolean(CompatEnergyControl.B_ACTIVE, this.heat > 0);
|
||||
data.setDouble(CompatEnergyControl.D_OUTPUT_HE, heat * 5D);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,11 +3,14 @@ package com.hbm.tileentity.machine;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
|
||||
import api.hbm.energy.IEnergyGenerator;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class TileEntityMachineSPP extends TileEntityLoadedBase implements IEnergyGenerator {
|
||||
public class TileEntityMachineSPP extends TileEntityLoadedBase implements IEnergyGenerator, IInfoProviderEC {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 100000;
|
||||
@ -86,4 +89,9 @@ public class TileEntityMachineSPP extends TileEntityLoadedBase implements IEnerg
|
||||
return this.maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideExtraInfo(NBTTagCompound data) {
|
||||
data.setBoolean(CompatEnergyControl.B_ACTIVE, this.gen > 0);
|
||||
data.setDouble(CompatEnergyControl.D_OUTPUT_HE, this.gen);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,7 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.handler.CompatHandler;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidContainer;
|
||||
import com.hbm.interfaces.IFluidSource;
|
||||
import com.hbm.inventory.container.ContainerMachineTurbine;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
@ -19,10 +14,12 @@ import com.hbm.packet.AuxElectricityPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energy.IEnergyGenerator;
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@ -42,14 +39,13 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityMachineTurbine extends TileEntityLoadedBase implements ISidedInventory, IFluidContainer, IFluidAcceptor, IFluidSource, IEnergyGenerator, IFluidStandardTransceiver, IGUIProvider, SimpleComponent {
|
||||
public class TileEntityMachineTurbine extends TileEntityLoadedBase implements ISidedInventory, IFluidContainer, IEnergyGenerator, IFluidStandardTransceiver, IGUIProvider, SimpleComponent, IInfoProviderEC {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 1000000;
|
||||
public int age = 0;
|
||||
public List<IFluidAcceptor> list2 = new ArrayList();
|
||||
public FluidTank[] tanks;
|
||||
|
||||
private static final int[] slots_top = new int[] {4};
|
||||
@ -57,6 +53,7 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS
|
||||
private static final int[] slots_side = new int[] {4};
|
||||
|
||||
private String customName;
|
||||
protected double[] info = new double[3];
|
||||
|
||||
public TileEntityMachineTurbine() {
|
||||
slots = new ItemStack[7];
|
||||
@ -230,16 +227,16 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.info = new double[3];
|
||||
|
||||
age++;
|
||||
if(age >= 2)
|
||||
{
|
||||
if(age >= 2) {
|
||||
age = 0;
|
||||
}
|
||||
|
||||
this.subscribeToAllAround(tanks[0].getTankType(), this);
|
||||
fillFluidInit(tanks[1].getTankType());
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
this.sendPower(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
|
||||
@ -262,6 +259,9 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS
|
||||
tanks[0].setFill(tanks[0].getFill() - ops * trait.amountReq);
|
||||
tanks[1].setFill(tanks[1].getFill() + ops * trait.amountProduced);
|
||||
this.power += (ops * trait.heatEnergy * eff);
|
||||
info[0] = ops * trait.amountReq;
|
||||
info[1] = ops * trait.amountProduced;
|
||||
info[2] = ops * trait.heatEnergy * eff;
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
@ -279,32 +279,6 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillFluidInit(FluidType type) {
|
||||
|
||||
fillFluid(this.xCoord + 1, this.yCoord, this.zCoord, getTact(), type);
|
||||
fillFluid(this.xCoord - 1, this.yCoord, this.zCoord, getTact(), type);
|
||||
fillFluid(this.xCoord, this.yCoord + 1, this.zCoord, getTact(), type);
|
||||
fillFluid(this.xCoord, this.yCoord - 1, this.zCoord, getTact(), type);
|
||||
fillFluid(this.xCoord, this.yCoord, this.zCoord + 1, getTact(), type);
|
||||
fillFluid(this.xCoord, this.yCoord, this.zCoord - 1, getTact(), type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillFluid(int x, int y, int z, boolean newTact, FluidType type) {
|
||||
Library.transmitFluid(x, y, z, newTact, this, worldObj, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTact() {
|
||||
if(age == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFluidFill(int i, FluidType type) {
|
||||
if(type.name().equals(tanks[0].getTankType().name()))
|
||||
@ -323,14 +297,6 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFluidFill(FluidType type) {
|
||||
if(type.name().equals(tanks[0].getTankType().name()))
|
||||
return tanks[0].getMaxFill();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFillForSync(int fill, int index) {
|
||||
if(index < 2 && tanks[index] != null)
|
||||
@ -343,16 +309,6 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS
|
||||
tanks[index].setTankType(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IFluidAcceptor> getFluidList(FluidType type) {
|
||||
return list2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearFluidList(FluidType type) {
|
||||
list2.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPower() {
|
||||
return power;
|
||||
@ -423,4 +379,12 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS
|
||||
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUIMachineTurbine(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideExtraInfo(NBTTagCompound data) {
|
||||
data.setBoolean(CompatEnergyControl.B_ACTIVE, info[1] > 0);
|
||||
data.setDouble(CompatEnergyControl.D_CONSUMPTION_MB, info[0]);
|
||||
data.setDouble(CompatEnergyControl.D_OUTPUT_MB, info[1]);
|
||||
data.setDouble(CompatEnergyControl.D_OUTPUT_HE, info[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,10 +16,12 @@ import com.hbm.lib.Library;
|
||||
import com.hbm.module.ModuleBurnTime;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.energy.IEnergyGenerator;
|
||||
import api.hbm.fluid.IFluidStandardReceiver;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@ -31,7 +33,7 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineWoodBurner extends TileEntityMachineBase implements IFluidStandardReceiver, IControlReceiver, IEnergyGenerator, IGUIProvider {
|
||||
public class TileEntityMachineWoodBurner extends TileEntityMachineBase implements IFluidStandardReceiver, IControlReceiver, IEnergyGenerator, IGUIProvider, IInfoProviderEC {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 100_000;
|
||||
@ -39,6 +41,7 @@ public class TileEntityMachineWoodBurner extends TileEntityMachineBase implement
|
||||
public int maxBurnTime;
|
||||
public boolean liquidBurn = false;
|
||||
public boolean isOn = false;
|
||||
protected int powerGen = 0;
|
||||
|
||||
public FluidTank tank;
|
||||
|
||||
@ -63,6 +66,8 @@ public class TileEntityMachineWoodBurner extends TileEntityMachineBase implement
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
powerGen = 0;
|
||||
|
||||
this.tank.setType(2, slots);
|
||||
this.tank.loadTank(3, 4, slots);
|
||||
this.power = Library.chargeItemsFromTE(slots, 5, power, maxPower);
|
||||
@ -96,8 +101,7 @@ public class TileEntityMachineWoodBurner extends TileEntityMachineBase implement
|
||||
|
||||
} else if(this.power < this.maxPower && isOn){
|
||||
this.burnTime--;
|
||||
this.power += 100;
|
||||
if(power > maxPower) this.power = this.maxPower;
|
||||
this.powerGen += 100;
|
||||
if(worldObj.getTotalWorldTime() % 20 == 0) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND);
|
||||
}
|
||||
|
||||
@ -111,7 +115,7 @@ public class TileEntityMachineWoodBurner extends TileEntityMachineBase implement
|
||||
int toBurn = Math.min(tank.getFill(), 2);
|
||||
|
||||
if(toBurn > 0) {
|
||||
this.power += trait.getHeatEnergy() * toBurn / 2_000L;
|
||||
this.powerGen += trait.getHeatEnergy() * toBurn / 2_000L;
|
||||
this.tank.setFill(this.tank.getFill() - toBurn);
|
||||
if(worldObj.getTotalWorldTime() % 20 == 0) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * toBurn / 2F);
|
||||
}
|
||||
@ -119,6 +123,7 @@ public class TileEntityMachineWoodBurner extends TileEntityMachineBase implement
|
||||
}
|
||||
}
|
||||
|
||||
this.power += this.powerGen;
|
||||
if(this.power > this.maxPower) this.power = this.maxPower;
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
@ -301,4 +306,11 @@ public class TileEntityMachineWoodBurner extends TileEntityMachineBase implement
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideExtraInfo(NBTTagCompound data) {
|
||||
data.setBoolean(CompatEnergyControl.B_ACTIVE, isOn);
|
||||
if(this.liquidBurn) data.setDouble(CompatEnergyControl.D_CONSUMPTION_MB, 1D);
|
||||
data.setDouble(CompatEnergyControl.D_OUTPUT_HE, power);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.hbm.tileentity.machine.storage;
|
||||
|
||||
import api.hbm.energy.*;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
|
||||
import com.hbm.blocks.machine.MachineBattery;
|
||||
import com.hbm.config.GeneralConfig;
|
||||
import com.hbm.inventory.container.ContainerMachineBattery;
|
||||
@ -9,6 +11,8 @@ import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.IPersistentNBT;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -32,7 +36,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "opencomputers")})
|
||||
public class TileEntityMachineBattery extends TileEntityMachineBase implements IEnergyUser, IPersistentNBT, SimpleComponent, IGUIProvider {
|
||||
public class TileEntityMachineBattery extends TileEntityMachineBase implements IEnergyUser, IPersistentNBT, SimpleComponent, IGUIProvider, IInfoProviderEC {
|
||||
|
||||
public long[] log = new long[20];
|
||||
public long delta = 0;
|
||||
@ -464,4 +468,9 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
|
||||
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUIMachineBattery(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideExtraInfo(NBTTagCompound data) {
|
||||
data.setLong(CompatEnergyControl.L_DIFF_HE, (log[0] - log[19]) / 20L);
|
||||
}
|
||||
}
|
||||
|
||||
163
src/main/java/com/hbm/util/CompatEnergyControl.java
Normal file
163
src/main/java/com/hbm/util/CompatEnergyControl.java
Normal file
@ -0,0 +1,163 @@
|
||||
package com.hbm.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineGasCent;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineGasCent.PseudoFluidTank;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKBase;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.fluid.IFluidUser;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/** Provides data specified by EC's CrossModBase */
|
||||
public class CompatEnergyControl {
|
||||
|
||||
/** Returns true for stacks with electric items like batteries or powertools (i.e. implements IBatteryItem) */
|
||||
public static boolean isElectricItem(ItemStack stack) {
|
||||
return stack.getItem() instanceof IBatteryItem;
|
||||
}
|
||||
|
||||
/** Standardized discharge for IBatteryItem, returns the amount that was removed */
|
||||
public static double dischargeItem(ItemStack stack, double needed) {
|
||||
IBatteryItem battery = (IBatteryItem) stack.getItem();
|
||||
long toDischarge = Math.min(battery.getDischargeRate(), Math.min(battery.getCharge(stack), (long) needed));
|
||||
battery.dischargeBattery(stack, toDischarge);
|
||||
return toDischarge;
|
||||
}
|
||||
|
||||
/** Returns the power and maxPower values for IEnergyUser */
|
||||
public static void getEnergyData(TileEntity tile, NBTTagCompound data) {
|
||||
|
||||
data.setString(KEY_EUTYPE, "HE");
|
||||
|
||||
if(tile instanceof IEnergyUser) {
|
||||
IEnergyUser user = (IEnergyUser) tile;
|
||||
data.setDouble(L_ENERGY_HE, user.getPower());
|
||||
data.setDouble(L_CAPACITY_HE, user.getMaxPower());
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the heat for RBMKs */
|
||||
public static int getHeat(TileEntity tile) {
|
||||
if(tile instanceof TileEntityRBMKBase) return (int) ((TileEntityRBMKBase) tile).heat;
|
||||
//original implementation also used the SNR and LNR for some reason, but those no longer exist. neither ZINOX nor research reactor were part of the system.
|
||||
return -1;
|
||||
}
|
||||
|
||||
/** Returns a list of Object arrays, one array for each fluid tank where the array contains fluid name, fill state and capacity (STRING, INTEGER, INTEGER) */
|
||||
public static List<Object[]> getAllTanks(TileEntity tile) {
|
||||
|
||||
List<Object[]> list = new ArrayList();
|
||||
|
||||
if(tile instanceof IFluidUser) {
|
||||
IFluidUser user = (IFluidUser) tile;
|
||||
|
||||
for(FluidTank tank : user.getAllTanks()) {
|
||||
if(tank.getTankType() == Fluids.SMOKE || tank.getTankType() == Fluids.SMOKE_LEADED || tank.getTankType() == Fluids.SMOKE_POISON) continue;
|
||||
list.add(toFluidInfo(tank));
|
||||
}
|
||||
}
|
||||
|
||||
if(tile instanceof TileEntityMachineGasCent) {
|
||||
TileEntityMachineGasCent cent = (TileEntityMachineGasCent) tile;
|
||||
list.add(toFluidInfo(cent.inputTank));
|
||||
list.add(toFluidInfo(cent.outputTank));
|
||||
}
|
||||
|
||||
if(!list.isEmpty()) return list;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Object[] toFluidInfo(FluidTank tank) {
|
||||
return new Object[] {tank.getTankType().getName(), tank.getFill(), tank.getMaxFill()};
|
||||
}
|
||||
|
||||
private static Object[] toFluidInfo(PseudoFluidTank tank) {
|
||||
return new Object[] {tank.getTankType().getName(), tank.getFill(), tank.getMaxFill()};
|
||||
}
|
||||
|
||||
/** Returns any non-standard data like progress, unique stats and so forth. Data comes from the IInfoProviderEC implementation */
|
||||
public static void getExtraData(TileEntity tile, NBTTagCompound data) {
|
||||
|
||||
if(tile instanceof IInfoProviderEC) {
|
||||
IInfoProviderEC provider = (IInfoProviderEC) tile;
|
||||
provider.provideExtraInfo(data);
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the core tile entity for that position, can resolve the MK1 "IMultiblock" and MK2 "BlockDummyable" systems. */
|
||||
public static TileEntity findTileEntity(World world, int x, int y, int z) {
|
||||
return CompatExternal.getCoreFromPos(world, x, y, z); //CompatExternal you're just standing around, do something for once
|
||||
}
|
||||
|
||||
/** Returns the ResourceLocation for the given fluid name */
|
||||
public static ResourceLocation getFluidTexture(String name) {
|
||||
FluidType type = Fluids.fromName(name);
|
||||
return type == null ? null : type.getTexture();
|
||||
}
|
||||
|
||||
/*
|
||||
* [DATA TYPE] _ [NAME] _ [UNIT]
|
||||
*/
|
||||
|
||||
public static final String KEY_EUTYPE = "euType";
|
||||
|
||||
public static final String L_ENERGY_HE = "energy";
|
||||
public static final String L_ENERGY_TU = "energyTU";
|
||||
public static final String L_ENERGY_ = "energy_"; // Blast Furnace fuel
|
||||
|
||||
public static final String L_CAPACITY_HE = "capacity";
|
||||
public static final String L_CAPACITY_TU = "capacityTU";
|
||||
public static final String L_CAPACITY_ = "capacity_"; // Blast Furnace fuel capacity
|
||||
|
||||
public static final String D_CONSUMPTION_HE = "consumptionHE";
|
||||
public static final String D_CONSUMPTION_MB = "consumption";
|
||||
@Deprecated public static final String S_CONSUMPTION_ = "consumption_"; // FWatz fluid consumption rates
|
||||
|
||||
public static final String D_OUTPUT_HE = "output";
|
||||
public static final String D_OUTPUT_MB = "outputmb";
|
||||
public static final String D_OUTPUT_TU = "outputTU";
|
||||
|
||||
public static final String L_DIFF_HE = "diff"; // Battery diff per tick
|
||||
@Deprecated public static final String I_TEMP_K = "temp"; // Unused?
|
||||
public static final String D_TURBINE_PERCENT = "turbine"; // CCGT slider
|
||||
public static final String I_TURBINE_SPEED = "speed"; // CCGT RPM
|
||||
public static final String L_COREHEAT_C = "core"; // Research Reactor core heat
|
||||
public static final String L_HULLHEAT_C = "hull"; // Research Reactor hull heat
|
||||
public static final String S_LEVEL_PERCENT = "level"; // Research Reactor rods
|
||||
@Deprecated public static final String L_HEATL = "heatL"; // AMS and old Watz heat values
|
||||
public static final String D_HEAT_C = "heat"; // Research Reactor and RBMK column heat
|
||||
public static final String L_PRESSURE_BAR = "bar"; // ZIRNOX pressure
|
||||
public static final String L_FUEL = "fuel"; // RTG Blast Furnace heat
|
||||
@Deprecated public static final String S_FUELTEXT = "fuelText"; // Large Nuclear Reactor only
|
||||
@Deprecated public static final String S_DEPLETED = "depleted"; // Large Nuclear Reactor only
|
||||
public static final String D_DEPLETION_PERCENT = "depletion"; // RBMK Fuel depletion
|
||||
public static final String D_XENON_PERCENT = "xenon"; // RBMK Fuel xenon poisoning
|
||||
public static final String D_SKIN_C = "skin"; // RBMK Fuel skin heat
|
||||
public static final String D_CORE_C = "c_heat"; // RBMK Fuel core heat
|
||||
public static final String D_MELT_C = "melt"; // RBMK Fuel melting point
|
||||
public static final String I_PROGRESS = "progress";
|
||||
public static final String I_FLUX = "flux"; // Research and Breeding Reactor flux
|
||||
public static final String I_WATER = "water"; // Research Reactor water gauge
|
||||
public static final String L_DURABILITY = "durability"; // DFC Stabilizer Lens
|
||||
public static final String S_TANK = "tank";
|
||||
public static final String S_TANK2 = "tank2";
|
||||
public static final String S_TANK3 = "tank3";
|
||||
public static final String S_TANK4 = "tank4";
|
||||
public static final String S_TANK5 = "tank5";
|
||||
@Deprecated public static final String I_PISTONS = "pistons"; // Radial Performance Engine piston count
|
||||
public static final String S_CHUNKRAD = "chunkRad"; // Geiger Counter
|
||||
public static final String B_ACTIVE = "active";
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user