Made TWire a trait and PartAbstract a class
This commit is contained in:
parent
00ab7e912b
commit
af305ec049
7 changed files with 28 additions and 28 deletions
|
@ -1,5 +1,6 @@
|
|||
package resonantinduction.core.prefab.part.connector
|
||||
|
||||
import codechicken.lib.data.MCDataInput
|
||||
import codechicken.multipart.{IRedstonePart, TMultiPart}
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.util.MovingObjectPosition
|
||||
|
@ -9,7 +10,7 @@ import resonantinduction.core.ResonantPartFactory
|
|||
import scala.collection.convert.wrapAll._
|
||||
import scala.collection.mutable
|
||||
|
||||
trait TPart extends TMultiPart with TraitTicker
|
||||
abstract class PartAbstract extends TMultiPart with TraitTicker
|
||||
{
|
||||
override def update()
|
||||
{
|
||||
|
@ -58,6 +59,16 @@ trait TPart extends TMultiPart with TraitTicker
|
|||
return false
|
||||
}
|
||||
|
||||
override def read(packet: MCDataInput)
|
||||
{
|
||||
read(packet, packet.readUByte)
|
||||
}
|
||||
|
||||
def read(packet: MCDataInput, packetID: Int)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
override def toString: String = "[" + getClass.getSimpleName + "]" + x + "x " + y + "y " + z + "z"
|
||||
|
||||
override def getType: String = ResonantPartFactory.prefix + getClass.getSimpleName
|
|
@ -41,7 +41,7 @@ object PartFramedNode
|
|||
}
|
||||
}
|
||||
|
||||
abstract class PartFramedNode extends TMultiPart with TNodePartConnector with TSlottedPart with TNormalOcclusion with TIconHitEffects
|
||||
abstract class PartFramedNode extends PartAbstract with TNodePartConnector with TSlottedPart with TNormalOcclusion with TIconHitEffects
|
||||
{
|
||||
/** Bitmask connections */
|
||||
var connectionMask: Byte = 0x00
|
||||
|
@ -162,12 +162,7 @@ abstract class PartFramedNode extends TMultiPart with TNodePartConnector with TS
|
|||
packet.writeByte(connectionMask)
|
||||
}
|
||||
|
||||
override def read(packet: MCDataInput)
|
||||
{
|
||||
read(packet, packet.readUByte)
|
||||
}
|
||||
|
||||
def read(packet: MCDataInput, packetID: Int)
|
||||
override def read(packet: MCDataInput, packetID: Int)
|
||||
{
|
||||
if (packetID == 0)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package resonantinduction.core.prefab.part.connector
|
||||
|
||||
import codechicken.lib.data.{MCDataInput, MCDataOutput}
|
||||
import codechicken.multipart.TMultiPart
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.nbt.NBTTagCompound
|
||||
|
@ -16,7 +15,8 @@ object TColorable
|
|||
{
|
||||
val defaultColor = 15
|
||||
}
|
||||
trait TColorable extends TMultiPart with TPart
|
||||
|
||||
trait TColorable extends PartAbstract
|
||||
{
|
||||
var colorID = TColorable.defaultColor
|
||||
|
||||
|
@ -73,7 +73,7 @@ trait TColorable extends TMultiPart with TPart
|
|||
packet.writeByte(colorID.toByte)
|
||||
}
|
||||
|
||||
def read(packet: MCDataInput, packetID: Int)
|
||||
override def read(packet: MCDataInput, packetID: Int)
|
||||
{
|
||||
if (packetID == 2)
|
||||
{
|
||||
|
|
|
@ -15,7 +15,7 @@ import scala.collection.mutable
|
|||
* Trait applied to objects that can be insulated/enhanced by a certain item.
|
||||
* @author Calclavia
|
||||
*/
|
||||
trait TInsulatable extends TMultiPart with TPart
|
||||
trait TInsulatable extends PartAbstract
|
||||
{
|
||||
/**
|
||||
* The item that is used to insulate this object.
|
||||
|
@ -106,7 +106,7 @@ trait TInsulatable extends TMultiPart with TPart
|
|||
_insulated = packet.readBoolean
|
||||
}
|
||||
|
||||
def read(packet: MCDataInput, packetID: Int)
|
||||
override def read(packet: MCDataInput, packetID: Int)
|
||||
{
|
||||
if (packetID == 1)
|
||||
_insulated = packet.readBoolean
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package resonantinduction.electrical.wire.base
|
||||
|
||||
import codechicken.lib.data.{MCDataInput, MCDataOutput}
|
||||
import codechicken.multipart.TMultiPart
|
||||
import net.minecraft.item.{Item, ItemStack}
|
||||
import net.minecraft.nbt.NBTTagCompound
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
|
@ -14,14 +13,14 @@ import universalelectricity.simulator.dc.DCNode
|
|||
* Abstract class extended by both flat and framed wires to handle material, insulation, color and multipart node logic.
|
||||
*
|
||||
* Packets:
|
||||
* 0 - Desc
|
||||
* 1 - Material
|
||||
* 2 - Insulation
|
||||
* 3 - Color
|
||||
* 0 - Desc
|
||||
* 1 - Material
|
||||
* 2 - Insulation
|
||||
* 3 - Color
|
||||
*
|
||||
* @author Calclavia
|
||||
*/
|
||||
abstract class TWire extends TMultiPart with TNodePartConnector with TPart with TMaterial[WireMaterial] with TInsulatable with TColorable
|
||||
trait TWire extends PartAbstract with TNodePartConnector with TMaterial[WireMaterial] with TInsulatable with TColorable
|
||||
{
|
||||
override protected val insulationItem: Item = ElectricalContent.itemInsulation
|
||||
|
||||
|
@ -53,11 +52,6 @@ abstract class TWire extends TMultiPart with TNodePartConnector with TPart with
|
|||
super[TColorable].readDesc(packet)
|
||||
}
|
||||
|
||||
override final def read(packet: MCDataInput)
|
||||
{
|
||||
read(packet, packet.readUByte)
|
||||
}
|
||||
|
||||
override def read(packet: MCDataInput, packetID: Int)
|
||||
{
|
||||
super[TInsulatable].read(packet, packetID)
|
||||
|
|
|
@ -17,6 +17,7 @@ import net.minecraftforge.common.util.ForgeDirection
|
|||
import org.lwjgl.opengl.GL11
|
||||
import resonantinduction.core.prefab.node.TMultipartNode
|
||||
import resonantinduction.core.prefab.part.ChickenBonesWrapper._
|
||||
import resonantinduction.core.prefab.part.connector.PartAbstract
|
||||
import resonantinduction.core.util.MultipartUtil
|
||||
import resonantinduction.electrical.wire.base.TWire
|
||||
import universalelectricity.api.core.grid.INodeProvider
|
||||
|
@ -53,7 +54,7 @@ object PartFlatWire
|
|||
}
|
||||
}
|
||||
|
||||
class PartFlatWire extends TWire with TFacePart with TNormalOcclusion
|
||||
class PartFlatWire extends PartAbstract with TWire with TFacePart with TNormalOcclusion
|
||||
{
|
||||
/**
|
||||
* The current side the wire is placed on
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
package resonantinduction.electrical.wire.framed
|
||||
|
||||
import resonantinduction.core.prefab.part.connector.PartFramedNode
|
||||
import resonantinduction.electrical.wire.base.TWire
|
||||
|
||||
/**
|
||||
* A framed version of the electrical wire
|
||||
* @author Calclavia
|
||||
*/
|
||||
class PartFramedWire extends TWire
|
||||
class PartFramedWire extends PartFramedNode with TWire
|
||||
{
|
||||
def preparePlacement(side: Int, meta: Int)
|
||||
{
|
||||
setMaterial(meta)
|
||||
}
|
||||
|
||||
override def getType = "FramedWire"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue