Override multi-inheritance method
This commit is contained in:
parent
6de100d385
commit
63be556890
3 changed files with 43 additions and 37 deletions
|
@ -56,4 +56,6 @@ trait TPart extends TMultiPart with TraitTicker
|
|||
}
|
||||
return false
|
||||
}
|
||||
|
||||
override def toString: String = "[" + getClass.getSimpleName + "]" + x + "x " + y + "y " + z + "z"
|
||||
}
|
|
@ -1,8 +1,11 @@
|
|||
package resonantinduction.electrical.wire.base
|
||||
|
||||
import codechicken.lib.data.{MCDataOutput, MCDataInput}
|
||||
import codechicken.multipart.TMultiPart
|
||||
import net.minecraft.item.{Item, ItemStack}
|
||||
import net.minecraft.nbt.NBTTagCompound
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import resonantinduction.core.prefab.part.{TColorable, TInsulatable, TMaterial}
|
||||
import resonantinduction.core.prefab.part.{TPart, TColorable, TInsulatable, TMaterial}
|
||||
import resonantinduction.electrical.ElectricalContent
|
||||
import universalelectricity.api.core.grid.INodeProvider
|
||||
import universalelectricity.simulator.dc.DCNode
|
||||
|
@ -11,7 +14,7 @@ import universalelectricity.simulator.dc.DCNode
|
|||
* Trait implemented by wires
|
||||
* @author Calclavia
|
||||
*/
|
||||
abstract class TWire extends TColorable with TMaterial[WireMaterial] with TInsulatable
|
||||
abstract class TWire extends TMultiPart with TPart with TMaterial[WireMaterial] with TInsulatable with TColorable
|
||||
{
|
||||
override protected val insulationItem: Item = ElectricalContent.itemInsulation
|
||||
|
||||
|
@ -26,6 +29,40 @@ abstract class TWire extends TColorable with TMaterial[WireMaterial] with TInsul
|
|||
|
||||
override protected def getItem = new ItemStack(ElectricalContent.itemInsulation, getMaterialID)
|
||||
|
||||
/**
|
||||
* Packet Methods
|
||||
*/
|
||||
override def readDesc(packet: MCDataInput)
|
||||
{
|
||||
super[TMaterial].readDesc(packet)
|
||||
super[TInsulatable].readDesc(packet)
|
||||
super[TColorable].readDesc(packet)
|
||||
}
|
||||
|
||||
override def writeDesc(packet: MCDataOutput)
|
||||
{
|
||||
super[TMaterial].writeDesc(packet)
|
||||
super[TInsulatable].writeDesc(packet)
|
||||
super[TColorable].writeDesc(packet)
|
||||
}
|
||||
|
||||
/**
|
||||
* NBT Methods
|
||||
*/
|
||||
override def load(nbt: NBTTagCompound)
|
||||
{
|
||||
super[TMaterial].load(nbt)
|
||||
super[TInsulatable].load(nbt)
|
||||
super[TColorable].load(nbt)
|
||||
}
|
||||
|
||||
override def save(nbt: NBTTagCompound)
|
||||
{
|
||||
super[TMaterial].save(nbt)
|
||||
super[TInsulatable].save(nbt)
|
||||
super[TColorable].save(nbt)
|
||||
}
|
||||
|
||||
/**
|
||||
* Can this conductor connect with another potential wire object?
|
||||
*/
|
||||
|
|
|
@ -28,6 +28,7 @@ import net.minecraft.util.MovingObjectPosition;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import resonantinduction.core.util.MultipartUtil;
|
||||
import resonantinduction.electrical.wire.base.TWire;
|
||||
import resonantinduction.electrical.wire.base.WireMaterial;
|
||||
|
||||
|
@ -81,20 +82,10 @@ public class PartFlatWire extends TWire implements TFacePart, TNormalOcclusion
|
|||
|
||||
}
|
||||
|
||||
public PartFlatWire(int typeID)
|
||||
{
|
||||
this(WireMaterial.values()[typeID]);
|
||||
}
|
||||
|
||||
public PartFlatWire(WireMaterial type)
|
||||
{
|
||||
material = type;
|
||||
}
|
||||
|
||||
public void preparePlacement(int side, int meta)
|
||||
{
|
||||
this.side = (byte) (side ^ 1);
|
||||
this.setMaterial(meta);
|
||||
setMaterial(meta);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -943,28 +934,4 @@ public class PartFlatWire extends TWire implements TFacePart, TNormalOcclusion
|
|||
CCRenderState.reset();
|
||||
RenderFlatWire.renderBreakingOverlay(renderBlocks.overrideBlockTexture, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility method to aid in initializing this or subclasses, usually when you need to change the
|
||||
* wire to another type
|
||||
*
|
||||
* @param otherCable the wire to copy from
|
||||
*/
|
||||
public void copyFrom(PartFlatWire otherCable)
|
||||
{
|
||||
this.isInsulated = otherCable.isInsulated;
|
||||
this.color = otherCable.color;
|
||||
this.connections_$eq(otherCable.connections());
|
||||
this.material = otherCable.material;
|
||||
this.side = otherCable.side;
|
||||
this.connMap = otherCable.connMap;
|
||||
//this.setNetwork(otherCable.getNetwork());
|
||||
//this.getNetwork().setBufferFor(this, otherCable.getNetwork().getBufferOf(otherCable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "[PartFlatWire]" + x() + "x " + y() + "y " + z() + "z " + getSlotMask() + "s ";
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue