Calclavia library overhaul
This commit is contained in:
parent
f9a4efa89b
commit
e2691ff96c
19 changed files with 86 additions and 110 deletions
|
@ -1 +1 @@
|
|||
Subproject commit 015fabb450c50680f81bd25011799b78ab838605
|
||||
Subproject commit ac3604f037fda53e100a34dc7b61b524f5ec3e0e
|
|
@ -10,23 +10,7 @@ import codechicken.multipart.TMultiPart;
|
|||
|
||||
public class MultipartRI implements IPartFactory
|
||||
{
|
||||
|
||||
public MultipartRI()
|
||||
{
|
||||
this.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TMultiPart createPart(String name, boolean client)
|
||||
{
|
||||
if (name == "resonant_induction_wire")
|
||||
return new PartWire();
|
||||
if (name == "resonant_induction_lain_wire")
|
||||
return new PartLainWire();
|
||||
return null;
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
MultiPartRegistry.registerParts(this, new String[] { "resonant_induction_wire", "resonant_induction_lain_wire" });
|
||||
MultipartGenerator.registerPassThroughInterface(IConductor.class.getName());
|
||||
|
@ -36,4 +20,18 @@ public class MultipartRI implements IPartFactory
|
|||
MultipartGenerator.registerTrait("ic2.api.energy.tile.IEnergySink", "resonantinduction.wire.TEnergySink");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TMultiPart createPart(String name, boolean client)
|
||||
{
|
||||
if (name.equals("resonant_induction_wire"))
|
||||
{
|
||||
return new PartWire();
|
||||
}
|
||||
else if (name.equals("resonant_induction_lain_wire"))
|
||||
{
|
||||
return new PartLainWire();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ import resonantinduction.tesla.TileEntityTesla;
|
|||
import resonantinduction.wire.EnumWireMaterial;
|
||||
import resonantinduction.wire.ItemPartWire;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import universalelectricity.core.item.IItemElectric;
|
||||
import universalelectricity.core.item.IElectricalItem;
|
||||
import basiccomponents.api.BasicRegistry;
|
||||
import calclavia.lib.UniversalRecipe;
|
||||
import calclavia.lib.network.PacketHandler;
|
||||
|
@ -276,7 +276,7 @@ public class ResonantInduction
|
|||
* Recipes
|
||||
*/
|
||||
ItemStack emptyCapacitor = new ItemStack(itemCapacitor);
|
||||
((IItemElectric) itemCapacitor).setElectricity(emptyCapacitor, 0);
|
||||
((IElectricalItem) itemCapacitor).setElectricity(emptyCapacitor, 0);
|
||||
|
||||
final ItemStack defaultWire = EnumWireMaterial.IRON.getWire();
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package resonantinduction.api;
|
||||
|
||||
import universalelectricity.core.item.IItemElectric;
|
||||
import universalelectricity.core.item.IElectricalItem;
|
||||
|
||||
/**
|
||||
* @author Calclavia
|
||||
*
|
||||
*/
|
||||
public interface ICapacitor extends IItemElectric
|
||||
public interface ICapacitor extends IElectricalItem
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package resonantinduction.battery;
|
|||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import universalelectricity.core.item.IItemElectric;
|
||||
import universalelectricity.core.item.IElectricalItem;
|
||||
|
||||
public class BatteryManager
|
||||
{
|
||||
|
@ -33,7 +33,7 @@ public class BatteryManager
|
|||
@Override
|
||||
public boolean isItemValid(ItemStack itemstack)
|
||||
{
|
||||
return itemstack.getItem() instanceof IItemElectric;
|
||||
return itemstack.getItem() instanceof IElectricalItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ public class ItemCapacitor extends ItemUniversalElectric implements ICapacitor
|
|||
}
|
||||
|
||||
@Override
|
||||
public float getMaxElectricityStored(ItemStack theItem)
|
||||
public float getElectricityCapacity(ItemStack theItem)
|
||||
{
|
||||
return 500;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ public class ItemInfiniteCapacitor extends ItemUniversalElectric
|
|||
}
|
||||
|
||||
@Override
|
||||
public float getMaxElectricityStored(ItemStack theItem)
|
||||
public float getElectricityCapacity(ItemStack theItem)
|
||||
{
|
||||
return Float.POSITIVE_INFINITY;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.util.Set;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import resonantinduction.base.ListUtil;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import universalelectricity.core.item.IItemElectric;
|
||||
import universalelectricity.core.item.IElectricalItem;
|
||||
|
||||
public class SynchronizedBatteryData
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ public class SynchronizedBatteryData
|
|||
|
||||
for (int i = 0; i < toSort.length - 1; i++)
|
||||
{
|
||||
if (((IItemElectric) toSort[i].getItem()).getElectricityStored(toSort[i]) < ((IItemElectric) toSort[i + 1].getItem()).getElectricityStored(toSort[i + 1]))
|
||||
if (((IElectricalItem) toSort[i].getItem()).getElectricityStored(toSort[i]) < ((IElectricalItem) toSort[i + 1].getItem()).getElectricityStored(toSort[i + 1]))
|
||||
{
|
||||
temp = toSort[i];
|
||||
toSort[i] = toSort[i + 1];
|
||||
|
|
|
@ -22,12 +22,12 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
import resonantinduction.ResonantInduction;
|
||||
import resonantinduction.api.ICapacitor;
|
||||
import resonantinduction.base.ListUtil;
|
||||
import universalelectricity.api.electricity.ElectricityPack;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import universalelectricity.compatibility.TileEntityUniversalElectrical;
|
||||
import universalelectricity.core.electricity.ElectricityPack;
|
||||
import universalelectricity.core.item.IItemElectric;
|
||||
import universalelectricity.core.item.IElectricalItem;
|
||||
import calclavia.lib.network.IPacketReceiver;
|
||||
import calclavia.lib.network.IPacketSender;
|
||||
import calclavia.lib.tile.TileEntityElectrical;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
|
@ -39,7 +39,7 @@ import cpw.mods.fml.common.network.Player;
|
|||
*
|
||||
* @author AidanBrady
|
||||
*/
|
||||
public class TileEntityBattery extends TileEntityUniversalElectrical implements IPacketSender, IPacketReceiver, IInventory
|
||||
public class TileEntityBattery extends TileEntityElectrical implements IPacketSender, IPacketReceiver, IInventory
|
||||
{
|
||||
public Set<EntityPlayer> playersUsing = new HashSet<EntityPlayer>();
|
||||
|
||||
|
@ -100,9 +100,9 @@ public class TileEntityBattery extends TileEntityUniversalElectrical implements
|
|||
|
||||
if (checkStack != null)
|
||||
{
|
||||
if (checkStack.getItem() instanceof IItemElectric)
|
||||
if (checkStack.getItem() instanceof IElectricalItem)
|
||||
{
|
||||
if (((IItemElectric) checkStack.getItem()).recharge(checkStack, provideElectricity(this.getTransferThreshhold(), false).getWatts(), false) > 0)
|
||||
if (((IElectricalItem) checkStack.getItem()).recharge(checkStack, provideElectricity(this.getTransferThreshhold(), false).getWatts(), false) > 0)
|
||||
{
|
||||
chargeItem = checkStack;
|
||||
break electricItemLoop;
|
||||
|
@ -117,9 +117,9 @@ public class TileEntityBattery extends TileEntityUniversalElectrical implements
|
|||
|
||||
if (checkStack != null)
|
||||
{
|
||||
if (checkStack.getItem() instanceof IItemElectric)
|
||||
if (checkStack.getItem() instanceof IElectricalItem)
|
||||
{
|
||||
if (((IItemElectric) checkStack.getItem()).recharge(checkStack, provideElectricity(this.getTransferThreshhold(), false).getWatts(), false) > 0)
|
||||
if (((IElectricalItem) checkStack.getItem()).recharge(checkStack, provideElectricity(this.getTransferThreshhold(), false).getWatts(), false) > 0)
|
||||
{
|
||||
chargeItem = checkStack;
|
||||
break electricItemLoop;
|
||||
|
@ -138,7 +138,7 @@ public class TileEntityBattery extends TileEntityUniversalElectrical implements
|
|||
if (chargeItem != null)
|
||||
{
|
||||
ItemStack itemStack = chargeItem;
|
||||
IItemElectric battery = (IItemElectric) itemStack.getItem();
|
||||
IElectricalItem battery = (IElectricalItem) itemStack.getItem();
|
||||
|
||||
float energyStored = getMaxEnergyStored();
|
||||
float batteryNeeded = battery.recharge(itemStack, provideElectricity(this.getTransferThreshhold(), false).getWatts(), false);
|
||||
|
@ -149,7 +149,7 @@ public class TileEntityBattery extends TileEntityUniversalElectrical implements
|
|||
if (structure.visibleInventory[2] != null)
|
||||
{
|
||||
ItemStack itemStack = structure.visibleInventory[2];
|
||||
IItemElectric battery = (IItemElectric) itemStack.getItem();
|
||||
IElectricalItem battery = (IElectricalItem) itemStack.getItem();
|
||||
|
||||
float energyNeeded = getMaxEnergyStored() - getEnergyStored();
|
||||
float batteryStored = battery.getElectricityStored(itemStack);
|
||||
|
@ -358,12 +358,12 @@ public class TileEntityBattery extends TileEntityUniversalElectrical implements
|
|||
|
||||
for (ItemStack itemStack : structure.inventory)
|
||||
{
|
||||
if (itemStack.getItem() instanceof IItemElectric)
|
||||
if (itemStack.getItem() instanceof IElectricalItem)
|
||||
{
|
||||
IItemElectric battery = (IItemElectric) itemStack.getItem();
|
||||
IElectricalItem battery = (IElectricalItem) itemStack.getItem();
|
||||
|
||||
float needed = amount - added;
|
||||
float itemAdd = Math.min(battery.getMaxElectricityStored(itemStack) - battery.getElectricityStored(itemStack), needed);
|
||||
float itemAdd = Math.min(battery.getElectricityCapacity(itemStack) - battery.getElectricityStored(itemStack), needed);
|
||||
|
||||
if (doAdd)
|
||||
{
|
||||
|
@ -392,9 +392,9 @@ public class TileEntityBattery extends TileEntityUniversalElectrical implements
|
|||
float removed = 0;
|
||||
for (ItemStack itemStack : inverse)
|
||||
{
|
||||
if (itemStack.getItem() instanceof IItemElectric)
|
||||
if (itemStack.getItem() instanceof IElectricalItem)
|
||||
{
|
||||
IItemElectric battery = (IItemElectric) itemStack.getItem();
|
||||
IElectricalItem battery = (IElectricalItem) itemStack.getItem();
|
||||
|
||||
float needed = amount - removed;
|
||||
float itemRemove = Math.min(battery.getElectricityStored(itemStack), needed);
|
||||
|
@ -427,9 +427,9 @@ public class TileEntityBattery extends TileEntityUniversalElectrical implements
|
|||
{
|
||||
if (itemStack != null)
|
||||
{
|
||||
if (itemStack.getItem() instanceof IItemElectric)
|
||||
if (itemStack.getItem() instanceof IElectricalItem)
|
||||
{
|
||||
max += ((IItemElectric) itemStack.getItem()).getMaxElectricityStored(itemStack);
|
||||
max += ((IElectricalItem) itemStack.getItem()).getElectricityCapacity(itemStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -453,9 +453,9 @@ public class TileEntityBattery extends TileEntityUniversalElectrical implements
|
|||
{
|
||||
if (itemStack != null)
|
||||
{
|
||||
if (itemStack.getItem() instanceof IItemElectric)
|
||||
if (itemStack.getItem() instanceof IElectricalItem)
|
||||
{
|
||||
energy += ((IItemElectric) itemStack.getItem()).getElectricityStored(itemStack);
|
||||
energy += ((IElectricalItem) itemStack.getItem()).getElectricityStored(itemStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -637,7 +637,7 @@ public class TileEntityBattery extends TileEntityUniversalElectrical implements
|
|||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemsSack)
|
||||
{
|
||||
return itemsSack.getItem() instanceof IItemElectric;
|
||||
return itemsSack.getItem() instanceof IElectricalItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package resonantinduction.furnace;
|
||||
|
||||
import net.minecraft.block.BlockFurnace;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -9,10 +8,10 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
import resonantinduction.ResonantInduction;
|
||||
import universalelectricity.api.UniversalClass;
|
||||
import universalelectricity.api.electricity.IVoltage;
|
||||
import universalelectricity.api.energy.IConductor;
|
||||
import universalelectricity.api.energy.IEnergyInterface;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import universalelectricity.core.block.IConductor;
|
||||
import calclavia.lib.prefab.block.EnergyStorage;
|
||||
import calclavia.lib.tile.EnergyStorage;
|
||||
|
||||
/**
|
||||
* Meant to replace the furnace class.
|
||||
|
@ -69,7 +68,8 @@ public class TileEntityAdvancedFurnace extends TileEntityFurnace implements IEne
|
|||
|
||||
if (doBlockStateUpdate != this.furnaceBurnTime > 0)
|
||||
{
|
||||
this.refreshConductors();
|
||||
// TODO: Send descript packet.
|
||||
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -153,19 +153,6 @@ public class TileEntityAdvancedFurnace extends TileEntityFurnace implements IEne
|
|||
this.doProduce = false;
|
||||
}
|
||||
|
||||
public void refreshConductors()
|
||||
{
|
||||
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
TileEntity tileEntity = new Vector3(this).modifyPositionFromSide(direction).getTileEntity(this.worldObj);
|
||||
|
||||
if (tileEntity instanceof IConductor)
|
||||
{
|
||||
((IConductor) tileEntity).refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection direction)
|
||||
{
|
||||
|
|
|
@ -10,8 +10,8 @@ import org.lwjgl.opengl.GL11;
|
|||
import resonantinduction.ResonantInduction;
|
||||
import resonantinduction.battery.ContainerBattery;
|
||||
import resonantinduction.battery.TileEntityBattery;
|
||||
import universalelectricity.api.electricity.ElectricityDisplay;
|
||||
import universalelectricity.api.electricity.ElectricityDisplay.ElectricUnit;
|
||||
import universalelectricity.api.energy.UnitDisplay;
|
||||
import universalelectricity.api.energy.UnitDisplay.Unit;
|
||||
|
||||
public class GuiBattery extends GuiContainer
|
||||
{
|
||||
|
@ -35,8 +35,8 @@ public class GuiBattery extends GuiContainer
|
|||
fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, 0x404040);
|
||||
fontRenderer.drawString("Cells: " + tileEntity.clientCells + " / " + tileEntity.structure.getMaxCells(), 62, 23, 0x404040);
|
||||
fontRenderer.drawString("Energy: ", 62, 33, 0x404040);
|
||||
fontRenderer.drawString(ElectricityDisplay.getDisplay(this.tileEntity.getEnergyStored(), ElectricUnit.JOULES, 4, true), 62, 43, 0x404040);
|
||||
fontRenderer.drawString("Max: " + ElectricityDisplay.getDisplayShort(this.tileEntity.getMaxEnergyStored(), ElectricUnit.JOULES), 62, 53, 0x404040);
|
||||
fontRenderer.drawString(UnitDisplay.getDisplay(this.tileEntity.getEnergyStored(), Unit.JOULES, 4, true), 62, 43, 0x404040);
|
||||
fontRenderer.drawString("Max: " + UnitDisplay.getDisplayShort(this.tileEntity.getMaxEnergyStored(), Unit.JOULES), 62, 53, 0x404040);
|
||||
fontRenderer.drawString("Percentage: " + (int) (this.tileEntity.getEnergyStored() / this.tileEntity.getMaxEnergyStored() * 100) + "%", 62, 63, 0x404040);
|
||||
fontRenderer.drawString("Volume: " + tileEntity.structure.getVolume(), 62, 73, 0x404040);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.HashMap;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import universalelectricity.api.electricity.ElectricalEvent.EnergyUpdateEvent;
|
||||
import universalelectricity.core.grid.IEnergyNetwork;
|
||||
import universalelectricity.api.energy.IEnergyNetwork;
|
||||
|
||||
/**
|
||||
* @author Calclavia
|
||||
|
|
|
@ -15,16 +15,13 @@ import net.minecraft.network.packet.Packet;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.ResonantInduction;
|
||||
import universalelectricity.core.block.IConductor;
|
||||
import universalelectricity.core.block.IConnector;
|
||||
import universalelectricity.core.block.IElectricalStorage;
|
||||
import universalelectricity.core.grid.IElectricityNetwork;
|
||||
import universalelectricity.api.IConnector;
|
||||
import universalelectricity.api.energy.IConductor;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import calclavia.lib.IRotatable;
|
||||
import calclavia.lib.network.IPacketReceiver;
|
||||
import calclavia.lib.network.IPacketSender;
|
||||
import calclavia.lib.prefab.tile.TileEntityAdvanced;
|
||||
import calclavia.lib.prefab.tile.TileEntityElectrical;
|
||||
import cofh.api.energy.TileEnergyHandler;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
@ -166,11 +163,11 @@ public class TileEntityMultimeter extends TileEntityAdvanced implements IConnect
|
|||
{
|
||||
if (tileEntity instanceof TileEntityElectrical)
|
||||
{
|
||||
return ((TileEntityElectrical) tileEntity).getEnergyStored();
|
||||
return ((TileEntityElectrical) tileEntity).getEnergy();
|
||||
}
|
||||
else if (tileEntity instanceof IElectricalStorage)
|
||||
{
|
||||
return ((IElectricalStorage) tileEntity).getEnergyStored();
|
||||
return ((IElectricalStorage) tileEntity).getEnergy();
|
||||
}
|
||||
else if (tileEntity instanceof IConductor)
|
||||
{
|
||||
|
|
|
@ -11,8 +11,8 @@ import org.lwjgl.opengl.GL11;
|
|||
import resonantinduction.ResonantInduction;
|
||||
import resonantinduction.model.ModelMultimeter;
|
||||
import resonantinduction.multimeter.TileEntityMultimeter;
|
||||
import universalelectricity.api.electricity.ElectricityDisplay;
|
||||
import universalelectricity.api.electricity.ElectricityDisplay.ElectricUnit;
|
||||
import universalelectricity.api.energy.UnitDisplay;
|
||||
import universalelectricity.api.energy.UnitDisplay.Unit;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -123,7 +123,7 @@ public class RenderMultimeter extends TileEntitySpecialRenderer
|
|||
|
||||
FontRenderer fontRenderer = this.getFontRenderer();
|
||||
|
||||
String joules = ElectricityDisplay.getDisplayShort(tileEntity.getDetectedEnergy(), ElectricUnit.JOULES);
|
||||
String joules = UnitDisplay.getDisplayShort(tileEntity.getDetectedEnergy(), Unit.JOULES);
|
||||
|
||||
int stringWidth = Math.max(fontRenderer.getStringWidth(joules), 0);
|
||||
// maxWidth += 8;
|
||||
|
|
|
@ -23,9 +23,8 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.ResonantInduction;
|
||||
import resonantinduction.api.ITesla;
|
||||
import universalelectricity.api.electricity.ElectricityPack;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import universalelectricity.compatibility.TileEntityUniversalElectrical;
|
||||
import universalelectricity.core.electricity.ElectricityPack;
|
||||
import calclavia.lib.network.IPacketReceiver;
|
||||
import calclavia.lib.network.IPacketSender;
|
||||
|
||||
|
@ -87,7 +86,7 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
|
|||
{
|
||||
super.updateEntity();
|
||||
|
||||
boolean doPacketUpdate = this.getEnergyStored() > 0;
|
||||
boolean doPacketUpdate = this.getEnergy() > 0;
|
||||
|
||||
/**
|
||||
* Only transfer if it is the bottom controlling Tesla tower.
|
||||
|
@ -96,7 +95,7 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
|
|||
{
|
||||
this.produce();
|
||||
|
||||
if (this.ticks % (5 + this.worldObj.rand.nextInt(2)) == 0 && ((this.worldObj.isRemote && this.doTransfer) || (this.getEnergyStored() > 0 && !this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord))))
|
||||
if (this.ticks % (5 + this.worldObj.rand.nextInt(2)) == 0 && ((this.worldObj.isRemote && this.doTransfer) || (this.getEnergy() > 0 && !this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord))))
|
||||
{
|
||||
final TileEntityTesla topTesla = this.getTopTelsa();
|
||||
final Vector3 topTeslaVector = new Vector3(topTesla);
|
||||
|
@ -120,7 +119,7 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
|
|||
|
||||
if (this.zapCounter % 5 == 0 && ResonantInduction.SOUND_FXS)
|
||||
{
|
||||
this.worldObj.playSoundEffect(this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5, ResonantInduction.PREFIX + "electricshock", this.getEnergyStored() / 25, 1.3f - 0.5f * (this.dyeID / 16f));
|
||||
this.worldObj.playSoundEffect(this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5, ResonantInduction.PREFIX + "electricshock", this.getEnergy() / 25, 1.3f - 0.5f * (this.dyeID / 16f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -190,14 +189,14 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
|
|||
|
||||
if (transferTeslaCoils.size() > 0)
|
||||
{
|
||||
float transferEnergy = this.getEnergyStored() / transferTeslaCoils.size();
|
||||
float transferEnergy = this.getEnergy() / transferTeslaCoils.size();
|
||||
int count = 0;
|
||||
boolean sentPacket = false;
|
||||
for (ITesla tesla : transferTeslaCoils)
|
||||
{
|
||||
if (this.zapCounter % 5 == 0 && ResonantInduction.SOUND_FXS)
|
||||
{
|
||||
this.worldObj.playSoundEffect(this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5, ResonantInduction.PREFIX + "electricshock", this.getEnergyStored() / 25, 1.3f - 0.5f * (this.dyeID / 16f));
|
||||
this.worldObj.playSoundEffect(this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5, ResonantInduction.PREFIX + "electricshock", this.getEnergy() / 25, 1.3f - 0.5f * (this.dyeID / 16f));
|
||||
}
|
||||
|
||||
Vector3 targetVector = new Vector3((TileEntity) tesla);
|
||||
|
@ -246,7 +245,7 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
|
|||
this.doTransfer = false;
|
||||
}
|
||||
|
||||
if (!this.worldObj.isRemote && this.getEnergyStored() > 0 != doPacketUpdate)
|
||||
if (!this.worldObj.isRemote && this.getEnergy() > 0 != doPacketUpdate)
|
||||
{
|
||||
this.sendPacket(2);
|
||||
}
|
||||
|
@ -297,7 +296,7 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
|
|||
{
|
||||
case 1:
|
||||
{
|
||||
data.add(this.getEnergyStored());
|
||||
data.add(this.getEnergy());
|
||||
data.add(this.dyeID);
|
||||
data.add(this.canReceive);
|
||||
data.add(this.attackEntities);
|
||||
|
@ -306,7 +305,7 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
|
|||
}
|
||||
case 2:
|
||||
{
|
||||
data.add(this.getEnergyStored());
|
||||
data.add(this.getEnergy());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -332,14 +331,14 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
|
|||
switch (data.readByte())
|
||||
{
|
||||
case 1:
|
||||
this.setEnergyStored(data.readFloat());
|
||||
this.setEnergy(data.readFloat());
|
||||
this.dyeID = data.readInt();
|
||||
this.canReceive = data.readBoolean();
|
||||
this.attackEntities = data.readBoolean();
|
||||
this.isLinkedClient = data.readBoolean();
|
||||
break;
|
||||
case 2:
|
||||
this.setEnergyStored(data.readFloat());
|
||||
this.setEnergy(data.readFloat());
|
||||
break;
|
||||
case 3:
|
||||
this.doTransfer = true;
|
||||
|
@ -377,10 +376,10 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
|
|||
}
|
||||
else
|
||||
{
|
||||
if (this.getEnergyStored() > 0)
|
||||
if (this.getEnergy() > 0)
|
||||
{
|
||||
transferEnergy += this.getEnergyStored();
|
||||
this.setEnergyStored(0);
|
||||
transferEnergy += this.getEnergy();
|
||||
this.setEnergy(0);
|
||||
}
|
||||
|
||||
return this.getControllingTelsa().transfer(transferEnergy, doTransfer);
|
||||
|
@ -614,7 +613,7 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
|
|||
{
|
||||
if (direction != ForgeDirection.DOWN)
|
||||
{
|
||||
return this.getMaxEnergyStored() - this.getEnergyStored();
|
||||
return this.getMaxEnergyStored() - this.getEnergy();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -625,7 +624,7 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
|
|||
{
|
||||
if (this.isController() && direction == ForgeDirection.DOWN)
|
||||
{
|
||||
return this.getEnergyStored();
|
||||
return this.getEnergy();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -14,8 +14,8 @@ import resonantinduction.TabRI;
|
|||
import resonantinduction.wire.part.PartLainWire;
|
||||
import resonantinduction.wire.part.PartWire;
|
||||
import resonantinduction.wire.render.RenderPartWire;
|
||||
import universalelectricity.api.electricity.ElectricityDisplay;
|
||||
import universalelectricity.api.electricity.ElectricityDisplay.ElectricUnit;
|
||||
import universalelectricity.api.energy.UnitDisplay;
|
||||
import universalelectricity.api.energy.UnitDisplay.Unit;
|
||||
import codechicken.lib.vec.BlockCoord;
|
||||
import codechicken.lib.vec.Vector3;
|
||||
import codechicken.multipart.JItemMultiPart;
|
||||
|
@ -62,8 +62,8 @@ public class ItemPartWire extends JItemMultiPart
|
|||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
list.add("Resistance: " + ElectricityDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].resistance, ElectricUnit.RESISTANCE));
|
||||
list.add("Max Amperage: " + ElectricityDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].maxAmps, ElectricUnit.AMPERE));
|
||||
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));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,11 +7,11 @@ import resonantinduction.base.PartAdvanced;
|
|||
import universalelectricity.api.UniversalClass;
|
||||
import universalelectricity.api.energy.IConductor;
|
||||
import universalelectricity.api.energy.IEnergyInterface;
|
||||
import universalelectricity.api.energy.IEnergyNetwork;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import universalelectricity.api.vector.VectorHelper;
|
||||
import universalelectricity.core.grid.EnergyNetworkLoader;
|
||||
import universalelectricity.core.grid.IEnergyNetwork;
|
||||
import calclavia.lib.prefab.block.EnergyStorage;
|
||||
import calclavia.lib.tile.EnergyStorage;
|
||||
import codechicken.multipart.TileMultipart;
|
||||
|
||||
@UniversalClass
|
||||
|
|
|
@ -15,8 +15,6 @@ import resonantinduction.wire.EnumWireMaterial;
|
|||
import resonantinduction.wire.IBlockableConnection;
|
||||
import resonantinduction.wire.render.RenderPartWire;
|
||||
import universalelectricity.api.energy.IConductor;
|
||||
import codechicken.lib.data.MCDataInput;
|
||||
import codechicken.lib.data.MCDataOutput;
|
||||
import codechicken.lib.lighting.LazyLightMatrix;
|
||||
import codechicken.lib.raytracer.IndexedCuboid6;
|
||||
import codechicken.lib.render.CCRenderState;
|
||||
|
|
|
@ -4,10 +4,6 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.lib.data.MCDataInput;
|
||||
import codechicken.lib.data.MCDataOutput;
|
||||
import codechicken.multipart.NormalOcclusionTest;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockColored;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -16,13 +12,14 @@ import net.minecraft.item.ItemShears;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.wire.EnumWireMaterial;
|
||||
import resonantinduction.wire.IBlockableConnection;
|
||||
import resonantinduction.wire.IInsulatedMaterial;
|
||||
import resonantinduction.wire.IInsulation;
|
||||
import resonantinduction.wire.IWireMaterial;
|
||||
import universalelectricity.api.energy.IConductor;
|
||||
import codechicken.lib.data.MCDataInput;
|
||||
import codechicken.lib.data.MCDataOutput;
|
||||
|
||||
/**
|
||||
* @author Calclavia
|
||||
|
@ -203,11 +200,11 @@ public abstract class PartWireBase extends PartConductor implements IInsulatedMa
|
|||
this.isInsulated = packet.readBoolean();
|
||||
this.currentWireConnections = packet.readByte();
|
||||
this.currentAcceptorConnections = packet.readByte();
|
||||
|
||||
if (tile() != null)
|
||||
{
|
||||
tile().markRender();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue