Tweaked multimeter detection code and gui
This commit is contained in:
parent
2f497bad58
commit
041f8ff5cd
8 changed files with 38 additions and 45 deletions
|
@ -1 +1 @@
|
|||
Subproject commit bf91ef825b4f6328e877857360a84039d71723df
|
||||
Subproject commit 1d94973d405930d7b68a25cc0040c82a671a8fc6
|
|
@ -1 +1 @@
|
|||
Subproject commit 5579379bc616b74e7b82c64c12d8fadf8df85e94
|
||||
Subproject commit e69dcdcd40ba67043852826a9486eaf132fbe0dc
|
|
@ -12,10 +12,10 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.ResonantInduction;
|
||||
import universalelectricity.api.energy.EnergyStorageHandler;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.network.IPacketReceiver;
|
||||
import calclavia.lib.network.IPacketSender;
|
||||
import calclavia.lib.tile.EnergyStorage;
|
||||
import calclavia.lib.tile.TileEntityElectrical;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
@ -45,7 +45,7 @@ public class TileBattery extends TileEntityElectrical implements IPacketSender,
|
|||
|
||||
public TileBattery()
|
||||
{
|
||||
this.energy = new EnergyStorage(1000);
|
||||
this.energy = new EnergyStorageHandler(1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,9 +8,10 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
import resonantinduction.ResonantInduction;
|
||||
import universalelectricity.api.CompatibilityModule;
|
||||
import universalelectricity.api.UniversalClass;
|
||||
import universalelectricity.api.energy.EnergyStorageHandler;
|
||||
import universalelectricity.api.energy.IEnergyContainer;
|
||||
import universalelectricity.api.energy.IEnergyInterface;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.tile.EnergyStorage;
|
||||
|
||||
/**
|
||||
* Meant to replace the furnace class.
|
||||
|
@ -19,11 +20,11 @@ import calclavia.lib.tile.EnergyStorage;
|
|||
*
|
||||
*/
|
||||
@UniversalClass
|
||||
public class TileAdvancedFurnace extends TileEntityFurnace implements IEnergyInterface
|
||||
public class TileAdvancedFurnace extends TileEntityFurnace implements IEnergyInterface, IEnergyContainer
|
||||
{
|
||||
private static final float WATTAGE = 5;
|
||||
|
||||
private EnergyStorage energy = new EnergyStorage(ResonantInduction.FURNACE_WATTAGE * 5);
|
||||
private EnergyStorageHandler energy = new EnergyStorageHandler(ResonantInduction.FURNACE_WATTAGE * 5);
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
|
@ -193,4 +194,22 @@ public class TileAdvancedFurnace extends TileEntityFurnace implements IEnergyInt
|
|||
{
|
||||
return this.energy.extractEnergy(request, doProvide);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergy(ForgeDirection from, long energy)
|
||||
{
|
||||
this.energy.setEnergy(energy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEnergy(ForgeDirection from)
|
||||
{
|
||||
return this.energy.getEnergy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEnergyCapacity(ForgeDirection from)
|
||||
{
|
||||
return this.energy.getEnergyCapacity();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.util.ResourceLocation;
|
|||
import resonantinduction.ResonantInduction;
|
||||
import resonantinduction.multimeter.ContainerMultimeter;
|
||||
import resonantinduction.multimeter.PartMultimeter;
|
||||
import universalelectricity.api.energy.UnitDisplay.Unit;
|
||||
import calclavia.lib.gui.GuiContainerBase;
|
||||
import calclavia.lib.prefab.TranslationHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
@ -75,8 +76,10 @@ public class GuiMultimeter extends GuiContainerBase
|
|||
{
|
||||
String s = TranslationHelper.getLocal("tile.resonantinduction:multimeter.name");
|
||||
this.fontRenderer.drawString(s, this.xSize / 2 - this.fontRenderer.getStringWidth(s) / 2, 15, 4210752);
|
||||
this.fontRenderer.drawString("Average Energy: " + Math.round(this.multimeter.getAverageDetectedEnergy()) + " J", 35, 25, 4210752);
|
||||
this.fontRenderer.drawString("Energy: " + Math.round(this.multimeter.getDetectedEnergy()) + " J", 35, 35, 4210752);
|
||||
this.fontRenderer.drawString("Average Energy:", 35, 15, 4210752);
|
||||
this.renderUniversalDisplay(35, 25, this.multimeter.getAverageDetectedEnergy(), par1, par2, Unit.JOULES);
|
||||
this.fontRenderer.drawString("Energy:", 35, 35, 4210752);
|
||||
this.renderUniversalDisplay(35, 45, this.multimeter.getDetectedEnergy(), par1, par2, Unit.JOULES);
|
||||
this.fontRenderer.drawString("Output Redstone If... ", 35, 54, 4210752);
|
||||
this.fontRenderer.drawString(this.multimeter.getMode().display, 35, 65, 4210752);
|
||||
this.fontRenderer.drawString("KiloJoules", 35, 100, 4210752);
|
||||
|
|
|
@ -15,22 +15,15 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import resonantinduction.ResonantInduction;
|
||||
import resonantinduction.base.PartAdvanced;
|
||||
import universalelectricity.api.CompatibilityType;
|
||||
import universalelectricity.api.CompatibilityModule;
|
||||
import universalelectricity.api.energy.IConductor;
|
||||
import universalelectricity.api.energy.IEnergyContainer;
|
||||
import universalelectricity.api.energy.IEnergyNetwork;
|
||||
import universalelectricity.api.net.IConnectable;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import codechicken.lib.data.MCDataInput;
|
||||
import codechicken.lib.data.MCDataOutput;
|
||||
import codechicken.lib.raytracer.IndexedCuboid6;
|
||||
import codechicken.lib.render.CCRenderState;
|
||||
import codechicken.lib.render.TextureUtils;
|
||||
import codechicken.lib.vec.Cuboid6;
|
||||
import codechicken.lib.vec.Rotation;
|
||||
import codechicken.lib.vec.Vector3;
|
||||
|
@ -38,8 +31,6 @@ import codechicken.multipart.JNormalOcclusion;
|
|||
import codechicken.multipart.NormalOcclusionTest;
|
||||
import codechicken.multipart.TFacePart;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import cofh.api.energy.TileEnergyHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -212,35 +203,15 @@ public class PartMultimeter extends PartAdvanced implements IConnectable, TFaceP
|
|||
return ForgeDirection.getOrientation(this.side);
|
||||
}
|
||||
|
||||
// TODO: Check if side is correct.
|
||||
public static long getDetectedEnergy(ForgeDirection side, TileEntity tileEntity)
|
||||
{
|
||||
if (tileEntity instanceof IEnergyContainer)
|
||||
{
|
||||
return ((IEnergyContainer) tileEntity).getEnergy(side);
|
||||
}
|
||||
else if (tileEntity instanceof IConductor)
|
||||
if (tileEntity instanceof IConductor)
|
||||
{
|
||||
IEnergyNetwork network = ((IConductor) tileEntity).getNetwork();
|
||||
return network.getLastBuffer();
|
||||
}
|
||||
else if (tileEntity instanceof IEnergyHandler)
|
||||
{
|
||||
return (long) (((IEnergyHandler) tileEntity).getEnergyStored(side) * CompatibilityType.INDUSTRIALCRAFT.reciprocal_ratio);
|
||||
}
|
||||
else if (tileEntity instanceof TileEnergyHandler)
|
||||
{
|
||||
return (long) (((TileEnergyHandler) tileEntity).getEnergyStored(side.getOpposite()) * CompatibilityType.THERMAL_EXPANSION.reciprocal_ratio);
|
||||
}
|
||||
else if (tileEntity instanceof IPowerReceptor)
|
||||
{
|
||||
if (((IPowerReceptor) tileEntity).getPowerReceiver(side) != null)
|
||||
{
|
||||
return (long) (((IPowerReceptor) tileEntity).getPowerReceiver(side).getEnergyStored() * CompatibilityType.BUILDCRAFT.reciprocal_ratio);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return CompatibilityModule.getEnergy(tileEntity, side);
|
||||
}
|
||||
|
||||
public void updateDetection(long detected)
|
||||
|
|
|
@ -22,11 +22,11 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.ResonantInduction;
|
||||
import resonantinduction.api.ITesla;
|
||||
import universalelectricity.api.energy.EnergyStorageHandler;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.network.IPacketReceiver;
|
||||
import calclavia.lib.network.IPacketSender;
|
||||
import calclavia.lib.prefab.CustomDamageSource;
|
||||
import calclavia.lib.tile.EnergyStorage;
|
||||
import calclavia.lib.tile.TileEntityElectrical;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
@ -77,7 +77,7 @@ public class TileTesla extends TileEntityElectrical implements ITesla, IPacketSe
|
|||
|
||||
public TileTesla()
|
||||
{
|
||||
this.energy = new EnergyStorage(TRANSFER_CAP);
|
||||
this.energy = new EnergyStorageHandler(TRANSFER_CAP);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -84,9 +84,9 @@ public class ItemWire extends JItemMultiPart
|
|||
else
|
||||
{
|
||||
list.add("Resistance: " + UnitDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].resistance, Unit.RESISTANCE));
|
||||
list.add("Max Amperage: " + UnitDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].maxAmps, Unit.AMPERE));
|
||||
list.add("Current Capacity: " + UnitDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].maxAmps, Unit.AMPERE));
|
||||
list.add("Shock Damage: " + EnumWireMaterial.values()[itemstack.getItemDamage()].damage);
|
||||
list.addAll(Calclavia.splitStringPerWord("The maximum transfer capacity can be increased and the energy loss may be reduced by using higher voltage.", 5));
|
||||
list.addAll(Calclavia.splitStringPerWord("The maximum energy transfer rate can be increased and the energy loss may be reduced by using higher the voltage of the network.", 5));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue