Fixed a few parts implementing getType on their own, and make getType final to prevent this in the future

This commit is contained in:
Robert S 2014-10-16 08:13:57 -04:00
parent d7bee7f649
commit 453903bbee
5 changed files with 33 additions and 73 deletions

View file

@ -71,5 +71,5 @@ abstract class PartAbstract extends TMultiPart with TraitTicker
override def toString: String = "[" + getClass.getSimpleName + "]" + x + "x " + y + "y " + z + "z"
override def getType: String = ResonantPartFactory.prefix + getClass.getSimpleName
final override def getType: String = ResonantPartFactory.prefix + getClass.getSimpleName
}

View file

@ -11,18 +11,18 @@ import net.minecraft.nbt.NBTTagCompound
import net.minecraft.util.MovingObjectPosition
import net.minecraftforge.common.util.ForgeDirection
import resonant.engine.ResonantEngine
import resonantinduction.core.prefab.part.connector.PartAbstract
import universalelectricity.api.core.grid.{INode, INodeProvider}
import universalelectricity.core.transform.vector.VectorWorld
/** We assume all the force acting on the gear is 90 degrees.
*
* @author Calclavia */
abstract class PartMechanical extends JCuboidPart with JNormalOcclusion with TFacePart with INodeProvider
abstract class PartMechanical extends PartAbstract with JNormalOcclusion with TFacePart with INodeProvider
{
/** Node that handles resonantinduction.mechanical action of the machine */
var node: MechanicalNode = null
protected var prevAngularVelocity: Double = .0
private[mech] var ticks: Int = 0
/** Packets */
private[mech] var markPacketUpdate: Boolean = false
/** Simple debug external GUI */
@ -54,11 +54,6 @@ abstract class PartMechanical extends JCuboidPart with JNormalOcclusion with TFa
override def update
{
ticks += 1
if (ticks >= java.lang.Long.MAX_VALUE)
{
ticks = 0
}
this.node.update
if (!world.isRemote)
{
@ -145,7 +140,7 @@ abstract class PartMechanical extends JCuboidPart with JNormalOcclusion with TFa
read(packet, packet.readUByte)
}
def read(packet: MCDataInput, packetID: Int)
override def read(packet: MCDataInput, packetID: Int)
{
if (packetID == 0)
{

View file

@ -1,17 +1,14 @@
package resonantinduction.mechanical.mech.gear
import codechicken.lib.vec.Rotation
import codechicken.multipart.TMultiPart
import codechicken.multipart.TileMultipart
import codechicken.multipart.{TMultiPart, TileMultipart}
import net.minecraft.tileentity.TileEntity
import net.minecraftforge.common.util.ForgeDirection
import resonantinduction.core.interfaces.IMechanicalNode
import resonantinduction.mechanical.mech.MechanicalNode
import resonantinduction.mechanical.mech.gearshaft.PartGearShaft
import universalelectricity.api.core.grid.INodeProvider
import universalelectricity.core.transform.vector.IVectorWorld
import universalelectricity.core.transform.vector.VectorWorld
import universalelectricity.core.transform.vector.Vector3
import universalelectricity.core.transform.vector.{IVectorWorld, Vector3, VectorWorld}
/**
* Node for the gear
@ -73,10 +70,7 @@ class GearNode(parent: PartGear) extends MechanicalNode(parent: PartGear)
addConnection(instance, gear.placementSide)
}
}
{
var i: Int = 0
while (i < 6)
{
for (i <- 0 until 6)
{
val checkDir: ForgeDirection = ForgeDirection.getOrientation(i)
var tile: TileEntity = gear.tile
@ -93,20 +87,12 @@ class GearNode(parent: PartGear) extends MechanicalNode(parent: PartGear)
}
}
}
({
i += 1; i - 1
})
}
}
var displaceCheck: Int = 1
if (gear.getMultiBlock.isPrimary && gear.getMultiBlock.isConstructed)
{
displaceCheck = 2
}
{
var i: Int = 0
while (i < 4)
{
for (i <- 0 until 4)
{
val checkDir: ForgeDirection = ForgeDirection.getOrientation(Rotation.rotateSide(gear.placementSide.ordinal, i))
val checkTile: TileEntity = new Vector3(gear.tile).add(checkDir).getTileEntity(world)
@ -119,11 +105,6 @@ class GearNode(parent: PartGear) extends MechanicalNode(parent: PartGear)
}
}
}
({
i += 1; i - 1
})
}
}
}
/**

View file

@ -29,19 +29,13 @@ object PartGear
oBoxes(0)(0) = new Cuboid6(1 / 8D, 0, 0, 7 / 8D, 1 / 8D, 1)
oBoxes(0)(1) = new Cuboid6(0, 0, 1 / 8D, 1, 1 / 8D, 7 / 8D)
{
var s: Int = 1
while (s < 6)
{
for(s <- 1 until 6)
{
val t: Transformation = Rotation.sideRotations(s).at(Vector3.center)
oBoxes(s)(0) = oBoxes(0)(0).copy.apply(t)
oBoxes(s)(1) = oBoxes(0)(1).copy.apply(t)
}
({
s += 1; s - 1
})
}
}
}
@ -145,11 +139,6 @@ class PartGear extends PartMechanical with IMultiBlockStructure[PartGear]
}
}
def getType: String =
{
return "resonant_induction_gear"
}
override def load(nbt: NBTTagCompound)
{
super.load(nbt)

View file

@ -58,11 +58,6 @@ class PartGearShaft extends PartMechanical
}
}
def getType: String =
{
return "resonant_induction_gear_shaft"
}
/**
* Multipart Bounds
*/