Commented out a few things on wires to allow for compiling
This commit is contained in:
parent
9842a1a0ad
commit
e522ddeb14
8 changed files with 74 additions and 290 deletions
|
@ -1,35 +1,20 @@
|
||||||
package resonantinduction.electrical
|
package resonantinduction.electrical
|
||||||
|
|
||||||
import cpw.mods.fml.client.registry.RenderingRegistry
|
import codechicken.multipart.{TMultiPart, TileMultipart}
|
||||||
|
import cpw.mods.fml.client.FMLClientHandler
|
||||||
|
import cpw.mods.fml.client.registry.{ClientRegistry, RenderingRegistry}
|
||||||
|
import cpw.mods.fml.relauncher.{Side, SideOnly}
|
||||||
import net.minecraft.block.Block
|
import net.minecraft.block.Block
|
||||||
import net.minecraft.entity.player.EntityPlayer
|
import net.minecraft.entity.player.EntityPlayer
|
||||||
import net.minecraft.tileentity.TileEntity
|
import net.minecraft.tileentity.TileEntity
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraftforge.client.MinecraftForgeClient
|
import resonantinduction.electrical.battery.{RenderBattery, TileBattery}
|
||||||
import net.minecraftforge.client.model.AdvancedModelLoader
|
|
||||||
import resonantinduction.electrical.battery.RenderBattery
|
|
||||||
import resonantinduction.electrical.battery.TileBattery
|
|
||||||
import resonantinduction.electrical.laser.BlockRenderingHandler
|
import resonantinduction.electrical.laser.BlockRenderingHandler
|
||||||
import resonantinduction.electrical.laser.emitter.RenderLaserEmitter
|
import resonantinduction.electrical.laser.fx.{EntityBlockParticleFX, EntityLaserFX, EntityScorchFX}
|
||||||
import resonantinduction.electrical.laser.focus.crystal.RenderFocusCrystal
|
import resonantinduction.electrical.multimeter.{GuiMultimeter, PartMultimeter}
|
||||||
import resonantinduction.electrical.laser.focus.mirror.RenderMirror
|
|
||||||
import resonantinduction.electrical.laser.fx.{EntityLaserFX, EntityBlockParticleFX, EntityScorchFX}
|
|
||||||
import resonantinduction.electrical.levitator.RenderLevitator
|
|
||||||
import resonantinduction.electrical.multimeter.GuiMultimeter
|
|
||||||
import resonantinduction.electrical.multimeter.PartMultimeter
|
|
||||||
import resonantinduction.electrical.multimeter.RenderMultimeter
|
|
||||||
import resonantinduction.electrical.render.FXElectricBolt
|
import resonantinduction.electrical.render.FXElectricBolt
|
||||||
import resonantinduction.electrical.tesla.RenderTesla
|
import resonantinduction.electrical.tesla.{RenderTesla, TileTesla}
|
||||||
import resonantinduction.electrical.tesla.TileTesla
|
|
||||||
import resonantinduction.electrical.transformer.RenderTransformer
|
|
||||||
import resonantinduction.atomic.gate.RenderQuantumGlyph
|
|
||||||
import universalelectricity.core.transform.vector.Vector3
|
import universalelectricity.core.transform.vector.Vector3
|
||||||
import codechicken.multipart.TMultiPart
|
|
||||||
import codechicken.multipart.TileMultipart
|
|
||||||
import cpw.mods.fml.client.FMLClientHandler
|
|
||||||
import cpw.mods.fml.client.registry.ClientRegistry
|
|
||||||
import cpw.mods.fml.relauncher.Side
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly
|
|
||||||
|
|
||||||
/** @author Calclavia */
|
/** @author Calclavia */
|
||||||
@SideOnly(Side.CLIENT) class ClientProxy extends CommonProxy {
|
@SideOnly(Side.CLIENT) class ClientProxy extends CommonProxy {
|
||||||
|
@ -40,9 +25,9 @@ import cpw.mods.fml.relauncher.SideOnly
|
||||||
|
|
||||||
override def init {
|
override def init {
|
||||||
RenderingRegistry.registerBlockHandler(new BlockRenderingHandler.type)
|
RenderingRegistry.registerBlockHandler(new BlockRenderingHandler.type)
|
||||||
ClientRegistry.bindTileEntitySpecialRenderer(classOf(TileLaserEmitter), RenderLaserEmitter)
|
//ClientRegistry.bindTileEntitySpecialRenderer(classOf(TileLaserEmitter), RenderLaserEmitter)
|
||||||
ClientRegistry.bindTileEntitySpecialRenderer(classOf(TileMirror), RenderMirror)
|
//ClientRegistry.bindTileEntitySpecialRenderer(classOf(TileMirror), RenderMirror)
|
||||||
ClientRegistry.bindTileEntitySpecialRenderer(classOf(TileFocusCrystal), RenderFocusCrystal)
|
//ClientRegistry.bindTileEntitySpecialRenderer(classOf(TileFocusCrystal), RenderFocusCrystal)
|
||||||
}
|
}
|
||||||
|
|
||||||
override def postInit {
|
override def postInit {
|
||||||
|
|
|
@ -18,9 +18,10 @@ public class MultipartElectrical implements IPartFactory
|
||||||
public MultipartElectrical()
|
public MultipartElectrical()
|
||||||
{
|
{
|
||||||
MultiPartRegistry.registerParts(this, PART_TYPES);
|
MultiPartRegistry.registerParts(this, PART_TYPES);
|
||||||
MultipartGenerator.registerPassThroughInterface("universalelectricity.api.electricity.IVoltageOutput");
|
//MultipartGenerator.registerPassThroughInterface("universalelectricity.api.electricity.IVoltageOutput");
|
||||||
MultipartGenerator.registerTrait("IQuantumGate", "TraitQuantumGate");
|
MultipartGenerator.registerTrait("IQuantumGate", "TraitQuantumGate");
|
||||||
MultipartGenerator.registerTrait("universalelectricity.api.energy.IConductor", "TraitConductor");
|
//MultipartGenerator.registerTrait("universalelectricity.api.energy.IConductor", "TraitConductor");
|
||||||
|
//TODO check if traits are already registered
|
||||||
MultipartGenerator.registerTrait("cofh.api.energy.IEnergyHandler", "TraitEnergyHandler");
|
MultipartGenerator.registerTrait("cofh.api.energy.IEnergyHandler", "TraitEnergyHandler");
|
||||||
MultipartGenerator.registerTrait("ic2.api.energy.tile.IEnergySink", "TraitEnergySink");
|
MultipartGenerator.registerTrait("ic2.api.energy.tile.IEnergySink", "TraitEnergySink");
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,6 @@ import net.minecraft.util.MovingObjectPosition;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import resonant.lib.prefab.damage.ElectricalDamage;
|
import resonant.lib.prefab.damage.ElectricalDamage;
|
||||||
import resonantinduction.core.prefab.part.MultipartUtility;
|
import resonantinduction.core.prefab.part.MultipartUtility;
|
||||||
import universalelectricity.api.CompatibilityModule;
|
|
||||||
import universalelectricity.api.electricity.IElectricalNetwork;
|
|
||||||
import universalelectricity.api.energy.IConductor;
|
|
||||||
import codechicken.lib.data.MCDataInput;
|
import codechicken.lib.data.MCDataInput;
|
||||||
import codechicken.lib.data.MCDataOutput;
|
import codechicken.lib.data.MCDataOutput;
|
||||||
import codechicken.multipart.IRedstonePart;
|
import codechicken.multipart.IRedstonePart;
|
||||||
|
@ -78,13 +75,13 @@ public abstract class PartAdvancedWire extends PartConductor
|
||||||
return Compatibility.isHandler(obj);
|
return Compatibility.isHandler(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
//@Override
|
||||||
public float getResistance()
|
public float getResistance()
|
||||||
{
|
{
|
||||||
return this.getMaterial().resistance;
|
return this.getMaterial().resistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
//@Override
|
||||||
public long getCurrentCapacity()
|
public long getCurrentCapacity()
|
||||||
{
|
{
|
||||||
return this.getMaterial().maxAmps;
|
return this.getMaterial().maxAmps;
|
||||||
|
@ -190,7 +187,7 @@ public abstract class PartAdvancedWire extends PartConductor
|
||||||
this.setColor(dyeColor);
|
this.setColor(dyeColor);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (itemStack.itemID == insulationType.itemID)
|
else if (itemStack.getItem() == insulationType.getItem())
|
||||||
{
|
{
|
||||||
if (this.isInsulated())
|
if (this.isInsulated())
|
||||||
{
|
{
|
||||||
|
@ -209,7 +206,7 @@ public abstract class PartAdvancedWire extends PartConductor
|
||||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setInsulated(BlockColored.getDyeFromBlock(itemStack.getItemDamage()));
|
this.setInsulated(itemStack.getItemDamage());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -229,7 +226,7 @@ public abstract class PartAdvancedWire extends PartConductor
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ItemStack getItem()
|
public ItemStack getItem()
|
||||||
{
|
{
|
||||||
return EnumWireMaterial.values()[getMaterialID()].getWire();
|
return EnumWireMaterial.values()[getMaterialID()].getWire();
|
||||||
}
|
}
|
||||||
|
@ -304,7 +301,7 @@ public abstract class PartAdvancedWire extends PartConductor
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean checkRedstone(int side)
|
public boolean checkRedstone(int side)
|
||||||
{
|
{
|
||||||
if (this.world().isBlockIndirectlyGettingPowered(x(), y(), z()))
|
if (this.world().isBlockIndirectlyGettingPowered(x(), y(), z()))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
package resonantinduction.electrical.wire
|
package resonantinduction.electrical.wire
|
||||||
|
|
||||||
import ic2.api.energy.event.EnergyTileLoadEvent
|
import codechicken.multipart.TMultiPart
|
||||||
import ic2.api.energy.event.EnergyTileUnloadEvent
|
import ic2.api.energy.event.{EnergyTileLoadEvent, EnergyTileUnloadEvent}
|
||||||
import ic2.api.energy.tile.IEnergyTile
|
import ic2.api.energy.tile.IEnergyTile
|
||||||
import net.minecraft.nbt.NBTTagCompound
|
import net.minecraft.nbt.NBTTagCompound
|
||||||
import net.minecraft.tileentity.TileEntity
|
import net.minecraft.tileentity.TileEntity
|
||||||
import net.minecraftforge.common.util.ForgeDirection
|
|
||||||
import net.minecraftforge.common.MinecraftForge
|
import net.minecraftforge.common.MinecraftForge
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection
|
||||||
import resonantinduction.core.prefab.part.TraitPart
|
import resonantinduction.core.prefab.part.TraitPart
|
||||||
import universalelectricity.api.UniversalClass
|
|
||||||
import universalelectricity.compatibility.Compatibility
|
import universalelectricity.compatibility.Compatibility
|
||||||
import universalelectricity.core.transform.vector.Vector3
|
import universalelectricity.core.transform.vector.{Vector3, VectorWorld}
|
||||||
import codechicken.multipart.TMultiPart
|
|
||||||
import universalelectricity.core.transform.vector.VectorWorld
|
|
||||||
import scala.util.control.Breaks._
|
import scala.util.control.Breaks._
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,14 +72,13 @@ abstract class PartConductor extends TMultiPart with TraitPart {
|
||||||
{
|
{
|
||||||
if (!world.isRemote)
|
if (!world.isRemote)
|
||||||
{
|
{
|
||||||
this.getNetwork.split(this)
|
//this.getNetwork.split(this)
|
||||||
if (tile.isInstanceOf[IEnergyTile]) {
|
if (tile.isInstanceOf[IEnergyTile]) {
|
||||||
var foundAnotherPart: Boolean = false
|
var foundAnotherPart: Boolean = false
|
||||||
var i: Int = 0
|
|
||||||
for(i <- 0 until tile.partList.size)
|
for(i <- 0 until tile.partList.size)
|
||||||
{
|
{
|
||||||
val part: TMultiPart = tile.partMap(i)
|
val part: TMultiPart = tile.partMap(i)
|
||||||
if (part.isInstanceOf[IEnergyTile] && part ne this) {
|
if (part.isInstanceOf[IEnergyTile] && part != this) {
|
||||||
foundAnotherPart = true
|
foundAnotherPart = true
|
||||||
break //todo: break is not supported
|
break //todo: break is not supported
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ import codechicken.lib.colour.Colour;
|
||||||
import codechicken.lib.colour.ColourARGB;
|
import codechicken.lib.colour.ColourARGB;
|
||||||
import codechicken.lib.data.MCDataInput;
|
import codechicken.lib.data.MCDataInput;
|
||||||
import codechicken.lib.data.MCDataOutput;
|
import codechicken.lib.data.MCDataOutput;
|
||||||
import codechicken.lib.lighting.LazyLightMatrix;
|
|
||||||
import codechicken.lib.raytracer.IndexedCuboid6;
|
import codechicken.lib.raytracer.IndexedCuboid6;
|
||||||
import codechicken.lib.render.CCRenderState;
|
import codechicken.lib.render.CCRenderState;
|
||||||
import codechicken.lib.render.TextureUtils;
|
import codechicken.lib.render.TextureUtils;
|
||||||
|
@ -345,12 +344,12 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
||||||
|
|
||||||
if (this.canConnectTo(tp, ForgeDirection.getOrientation(absDir)))
|
if (this.canConnectTo(tp, ForgeDirection.getOrientation(absDir)))
|
||||||
{
|
{
|
||||||
this.connections[absDir] = tp;
|
this.connections()[absDir] = tp;
|
||||||
|
|
||||||
if (tp instanceof PartFlatWire)
|
if (tp instanceof PartFlatWire)
|
||||||
{
|
{
|
||||||
// We found a wire, merge networks!
|
// We found a wire, merge networks!
|
||||||
this.getNetwork().merge(((PartFlatWire) tp).getNetwork());
|
//this.getNetwork().merge(((PartFlatWire) tp).getNetwork());
|
||||||
}
|
}
|
||||||
|
|
||||||
calculatedSides[absDir] = true;
|
calculatedSides[absDir] = true;
|
||||||
|
@ -379,11 +378,11 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
||||||
if (this.canConnectTo(tp))
|
if (this.canConnectTo(tp))
|
||||||
{
|
{
|
||||||
// We found a wire! Merge networks!
|
// We found a wire! Merge networks!
|
||||||
this.connections[absDir] = tp;
|
this.connections()[absDir] = tp;
|
||||||
|
|
||||||
if (tp instanceof PartFlatWire)
|
if (tp instanceof PartFlatWire)
|
||||||
{
|
{
|
||||||
this.getNetwork().merge(((PartFlatWire) tp).getNetwork());
|
//this.getNetwork().merge(((PartFlatWire) tp).getNetwork());
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -398,7 +397,7 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
||||||
// Connect to the face of the block the wire is placed on.
|
// Connect to the face of the block the wire is placed on.
|
||||||
this.setExternalConnection(-1, this.side);
|
this.setExternalConnection(-1, this.side);
|
||||||
|
|
||||||
this.getNetwork().reconstruct();
|
//this.getNetwork().reconstruct();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean setExternalConnection(int r, int absSide)
|
public boolean setExternalConnection(int r, int absSide)
|
||||||
|
@ -420,15 +419,15 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
||||||
if (tp instanceof PartFlatWire && ((PartFlatWire) tp).canConnectTo(this, ForgeDirection.getOrientation(absSide).getOpposite()) && ((PartFlatWire) tp).maskOpen(otherR))
|
if (tp instanceof PartFlatWire && ((PartFlatWire) tp).canConnectTo(this, ForgeDirection.getOrientation(absSide).getOpposite()) && ((PartFlatWire) tp).maskOpen(otherR))
|
||||||
{
|
{
|
||||||
// We found a wire! Merge connection.
|
// We found a wire! Merge connection.
|
||||||
connections[absSide] = tp;
|
connections()[absSide] = tp;
|
||||||
getNetwork().merge(((PartFlatWire) tp).getNetwork());
|
//getNetwork().merge(((PartFlatWire) tp).getNetwork());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check for a micro-energy block */
|
/** Check for a micro-energy block */
|
||||||
if (canConnectTo(tp))
|
if (canConnectTo(tp))
|
||||||
{
|
{
|
||||||
connections[absSide] = tp;
|
connections()[absSide] = tp;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -441,7 +440,7 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
||||||
|
|
||||||
if (this.canConnectTo(tileEntity, ForgeDirection.getOrientation(absSide)))
|
if (this.canConnectTo(tileEntity, ForgeDirection.getOrientation(absSide)))
|
||||||
{
|
{
|
||||||
this.connections[absSide] = tileEntity;
|
this.connections()[absSide] = tileEntity;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,17 +453,17 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
||||||
{
|
{
|
||||||
if (!this.world().isRemote)
|
if (!this.world().isRemote)
|
||||||
{
|
{
|
||||||
if (this.connections[i] != null)
|
if (this.connections()[i] != null)
|
||||||
{
|
{
|
||||||
if (this.connections[i] instanceof PartFlatWire)
|
if (this.connections()[i] instanceof PartFlatWire)
|
||||||
{
|
{
|
||||||
PartFlatWire wire = (PartFlatWire) this.connections[i];
|
PartFlatWire wire = (PartFlatWire) this.connections()[i];
|
||||||
this.connections[i] = null;
|
this.connections()[i] = null;
|
||||||
this.getNetwork().split(this, wire);
|
//this.getNetwork().split(this, wire);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.connections[i] = null;
|
this.connections()[i] = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -473,7 +472,7 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
||||||
@Override
|
@Override
|
||||||
public Object[] getConnections()
|
public Object[] getConnections()
|
||||||
{
|
{
|
||||||
return this.connections;
|
return this.connections();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canStay()
|
public boolean canStay()
|
||||||
|
@ -908,14 +907,16 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void renderStatic(Vector3 pos, LazyLightMatrix olm, int pass)
|
public boolean renderStatic(Vector3 pos, int pass)
|
||||||
{
|
{
|
||||||
if (pass == 0 && useStaticRenderer())
|
if (pass == 0 && useStaticRenderer())
|
||||||
{
|
{
|
||||||
CCRenderState.setBrightness(world(), x(), y(), z());
|
CCRenderState.setBrightness(world(), x(), y(), z());
|
||||||
RenderFlatWire.render(this, pos);
|
RenderFlatWire.render(this, pos);
|
||||||
CCRenderState.setColour(-1);
|
CCRenderState.setColour(-1);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -926,7 +927,7 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
||||||
{
|
{
|
||||||
GL11.glDisable(GL11.GL_LIGHTING);
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
TextureUtils.bindAtlas(0);
|
TextureUtils.bindAtlas(0);
|
||||||
CCRenderState.useModelColours(true);
|
//CCRenderState.useModelColours(true);
|
||||||
CCRenderState.startDrawing(7);
|
CCRenderState.startDrawing(7);
|
||||||
RenderFlatWire.render(this, pos);
|
RenderFlatWire.render(this, pos);
|
||||||
CCRenderState.draw();
|
CCRenderState.draw();
|
||||||
|
@ -951,12 +952,12 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
||||||
{
|
{
|
||||||
this.isInsulated = otherCable.isInsulated;
|
this.isInsulated = otherCable.isInsulated;
|
||||||
this.color = otherCable.color;
|
this.color = otherCable.color;
|
||||||
this.connections = otherCable.connections;
|
this.connections_$eq(otherCable.connections());
|
||||||
this.material = otherCable.material;
|
this.material = otherCable.material;
|
||||||
this.side = otherCable.side;
|
this.side = otherCable.side;
|
||||||
this.connMap = otherCable.connMap;
|
this.connMap = otherCable.connMap;
|
||||||
this.setNetwork(otherCable.getNetwork());
|
//this.setNetwork(otherCable.getNetwork());
|
||||||
this.getNetwork().setBufferFor(this, otherCable.getNetwork().getBufferOf(otherCable));
|
//this.getNetwork().setBufferFor(this, otherCable.getNetwork().getBufferOf(otherCable));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -3,10 +3,7 @@ package resonantinduction.electrical.wire.flat;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
import codechicken.lib.render.uv.IconTransformation;
|
import codechicken.lib.render.uv.*;
|
||||||
import codechicken.lib.render.uv.UV;
|
|
||||||
import codechicken.lib.render.uv.UVScale;
|
|
||||||
import codechicken.lib.render.uv.UVTranslation;
|
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import codechicken.lib.lighting.LightModel;
|
import codechicken.lib.lighting.LightModel;
|
||||||
import codechicken.lib.math.MathHelper;
|
import codechicken.lib.math.MathHelper;
|
||||||
|
@ -24,7 +21,7 @@ public class RenderFlatWire
|
||||||
{
|
{
|
||||||
public static IIcon flatWireTexture;
|
public static IIcon flatWireTexture;
|
||||||
|
|
||||||
public static class UVT implements IUVTransformation
|
public static class UVT extends UVTransformation
|
||||||
{
|
{
|
||||||
public Transformation t;
|
public Transformation t;
|
||||||
private Vector3 vec = new Vector3();
|
private Vector3 vec = new Vector3();
|
||||||
|
@ -34,13 +31,18 @@ public class RenderFlatWire
|
||||||
this.t = t;
|
this.t = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void transform(UV uv)
|
public void apply(UV uv)
|
||||||
{
|
{
|
||||||
vec.set(uv.u, 0, uv.v).apply(t);
|
vec.set(uv.u, 0, uv.v).apply(t);
|
||||||
uv.set(vec.x, vec.z);
|
uv.set(vec.x, vec.z);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public UVTransformation inverse() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static int[] reorientSide = new int[] { 0, 3, 3, 0, 0, 3 };
|
public static int[] reorientSide = new int[] { 0, 3, 3, 0, 0, 3 };
|
||||||
|
|
||||||
|
@ -285,7 +287,7 @@ public class RenderFlatWire
|
||||||
|
|
||||||
if (r != 0)
|
if (r != 0)
|
||||||
{
|
{
|
||||||
IUVTransformation uvt = new UVT(Rotation.quarterRotations[r % 4].at(new Vector3(8, 0, 16)));
|
UVTransformation uvt = new UVT(Rotation.quarterRotations[r % 4].at(new Vector3(8, 0, 16)));
|
||||||
for (Vertex5 vert : verts)
|
for (Vertex5 vert : verts)
|
||||||
vert.apply(uvt);
|
vert.apply(uvt);
|
||||||
}
|
}
|
||||||
|
@ -408,9 +410,10 @@ public class RenderFlatWire
|
||||||
|
|
||||||
public static void render(PartFlatWire w, Vector3 pos)
|
public static void render(PartFlatWire w, Vector3 pos)
|
||||||
{
|
{
|
||||||
IVertexModifier m = w.getColour().pack() == -1 ? ColourModifier.instance : new ColourMultiplier(w.getColour());
|
//TODO
|
||||||
CCModel model = getOrGenerateModel(modelKey(w));
|
//IVertexModifier m = w.getColour().pack() == -1 ? ColourModifier.instance : new ColourMultiplier(w.getColour());
|
||||||
model.render(new Translation(pos), new IconTransformation(w.getIcon()), m);
|
//CCModel model = getOrGenerateModel(modelKey(w));
|
||||||
|
//model.render(new Translation(pos), new IconTransformation(w.getIcon()), m);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void renderInv(int thickness, Transformation t, IIcon icon)
|
public static void renderInv(int thickness, Transformation t, IIcon icon)
|
||||||
|
@ -463,7 +466,7 @@ public class RenderFlatWire
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Cuboid6 box : boxes)
|
//TODO for (Cuboid6 box : boxes)
|
||||||
RenderUtils.renderBlock(box, 0, new Translation(wire.x(), wire.y(), wire.z()), new IconTransformation(icon), null);
|
//RenderUtils.renderBlock(box, 0, new Translation(wire.x(), wire.y(), wire.z()), new IconTransformation(icon), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,200 +0,0 @@
|
||||||
package resonantinduction.electrical.wire.trait;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
import universalelectricity.api.energy.IConductor;
|
|
||||||
import universalelectricity.api.energy.IEnergyNetwork;
|
|
||||||
import universalelectricity.api.net.IConnector;
|
|
||||||
import codechicken.multipart.PartMap;
|
|
||||||
import codechicken.multipart.TMultiPart;
|
|
||||||
import codechicken.multipart.TileMultipart;
|
|
||||||
|
|
||||||
public class TraitConductor extends TileMultipart implements IConductor
|
|
||||||
{
|
|
||||||
public Set<IConductor> ueInterfaces = new HashSet<IConductor>();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void copyFrom(TileMultipart that)
|
|
||||||
{
|
|
||||||
super.copyFrom(that);
|
|
||||||
|
|
||||||
if (that instanceof TraitConductor)
|
|
||||||
{
|
|
||||||
this.ueInterfaces = ((TraitConductor) that).ueInterfaces;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void bindPart(TMultiPart part)
|
|
||||||
{
|
|
||||||
super.bindPart(part);
|
|
||||||
|
|
||||||
if (part instanceof IConductor)
|
|
||||||
{
|
|
||||||
this.ueInterfaces.add((IConductor) part);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void partRemoved(TMultiPart part, int p)
|
|
||||||
{
|
|
||||||
super.partRemoved(part, p);
|
|
||||||
|
|
||||||
if (part instanceof IConductor)
|
|
||||||
{
|
|
||||||
this.ueInterfaces.remove(part);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void clearParts()
|
|
||||||
{
|
|
||||||
super.clearParts();
|
|
||||||
this.ueInterfaces.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object[] getConnections()
|
|
||||||
{
|
|
||||||
for (IConductor conductor : this.ueInterfaces)
|
|
||||||
{
|
|
||||||
return conductor.getConnections();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IEnergyNetwork getNetwork()
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setNetwork(IEnergyNetwork network)
|
|
||||||
{
|
|
||||||
for (IConductor conductor : this.ueInterfaces)
|
|
||||||
{
|
|
||||||
conductor.setNetwork(network);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canConnect(ForgeDirection direction, Object source)
|
|
||||||
{
|
|
||||||
for (IConductor conductor : this.ueInterfaces)
|
|
||||||
{
|
|
||||||
if (conductor.canConnect(direction.getOpposite(), source))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long onReceiveEnergy(ForgeDirection from, long receive, boolean doReceive)
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Try out different sides to try to inject energy into.
|
|
||||||
*/
|
|
||||||
if (partMap(from.ordinal()) instanceof IConductor)
|
|
||||||
{
|
|
||||||
return ((IConductor) partMap(from.ordinal())).onReceiveEnergy(from, receive, doReceive);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
|
||||||
{
|
|
||||||
if (dir != from.getOpposite())
|
|
||||||
{
|
|
||||||
TMultiPart part = this.partMap(dir.ordinal());
|
|
||||||
|
|
||||||
if (this.ueInterfaces.contains(part))
|
|
||||||
{
|
|
||||||
return ((IConductor) part).onReceiveEnergy(from, receive, doReceive);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (partMap(PartMap.CENTER.ordinal()) instanceof IConductor)
|
|
||||||
{
|
|
||||||
return ((IConductor) partMap(PartMap.CENTER.ordinal())).onReceiveEnergy(from, receive, doReceive);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long onExtractEnergy(ForgeDirection from, long extract, boolean doExtract)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getResistance()
|
|
||||||
{
|
|
||||||
long energyLoss = 0;
|
|
||||||
|
|
||||||
if (this.ueInterfaces.size() > 0)
|
|
||||||
{
|
|
||||||
for (IConductor conductor : this.ueInterfaces)
|
|
||||||
{
|
|
||||||
energyLoss += conductor.getResistance();
|
|
||||||
}
|
|
||||||
|
|
||||||
energyLoss /= this.ueInterfaces.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
return energyLoss;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getCurrentCapacity()
|
|
||||||
{
|
|
||||||
long capacitance = 0;
|
|
||||||
|
|
||||||
if (this.ueInterfaces.size() > 0)
|
|
||||||
{
|
|
||||||
for (IConductor conductor : this.ueInterfaces)
|
|
||||||
{
|
|
||||||
capacitance += conductor.getCurrentCapacity();
|
|
||||||
}
|
|
||||||
|
|
||||||
capacitance /= this.ueInterfaces.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
return capacitance;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IConductor getInstance(ForgeDirection from)
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Try out different sides to try to inject energy into.
|
|
||||||
*/
|
|
||||||
if (partMap(from.ordinal()) instanceof IConductor)
|
|
||||||
{
|
|
||||||
return (IConductor) partMap(from.ordinal());
|
|
||||||
}
|
|
||||||
|
|
||||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
|
||||||
{
|
|
||||||
TMultiPart part = this.partMap(dir.ordinal());
|
|
||||||
|
|
||||||
if (this.ueInterfaces.contains(part))
|
|
||||||
{
|
|
||||||
return (IConductor) ((IConductor) part).getInstance(from);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (partMap(PartMap.CENTER.ordinal()) instanceof IConductor)
|
|
||||||
{
|
|
||||||
return (IConductor) (IConnector<IEnergyNetwork>) partMap(PartMap.CENTER.ordinal());
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -110,7 +110,7 @@ public class TraitEnergyHandler extends TileMultipart implements IEnergyHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInterface(ForgeDirection from)
|
public boolean canConnectEnergy(ForgeDirection from)
|
||||||
{
|
{
|
||||||
if (this.partMap(from.ordinal()) == null)
|
if (this.partMap(from.ordinal()) == null)
|
||||||
{
|
{
|
||||||
|
@ -122,7 +122,7 @@ public class TraitEnergyHandler extends TileMultipart implements IEnergyHandler
|
||||||
|
|
||||||
if (this.teConductorInterfaces.contains(part))
|
if (this.teConductorInterfaces.contains(part))
|
||||||
{
|
{
|
||||||
return ((IEnergyHandler) part).canInterface(from);
|
return ((IEnergyHandler) part).canConnectEnergy(from);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ public class TraitEnergyHandler extends TileMultipart implements IEnergyHandler
|
||||||
|
|
||||||
for (IEnergyHandler handler : this.teInterfaces)
|
for (IEnergyHandler handler : this.teInterfaces)
|
||||||
{
|
{
|
||||||
return handler.canInterface(from);
|
return handler.canConnectEnergy(from);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue