Fixed multipart trait TNodeProvider not registering
This commit is contained in:
parent
44208669ef
commit
b5c70a5fb2
4 changed files with 17 additions and 48 deletions
|
@ -1,7 +1,7 @@
|
|||
package resonantinduction.core
|
||||
|
||||
import codechicken.multipart.MultiPartRegistry.IPartFactory
|
||||
import codechicken.multipart.{MultiPartRegistry, TMultiPart}
|
||||
import codechicken.multipart.{MultipartGenerator, MultiPartRegistry, TMultiPart}
|
||||
|
||||
import scala.collection.mutable
|
||||
|
||||
|
@ -11,7 +11,6 @@ import scala.collection.mutable
|
|||
object ResonantPartFactory extends IPartFactory
|
||||
{
|
||||
val prefix = Reference.prefix
|
||||
|
||||
private val partMap = mutable.Map.empty[String, Class[_ <: TMultiPart]]
|
||||
|
||||
def register(part: Class[_ <: TMultiPart])
|
||||
|
@ -21,7 +20,12 @@ object ResonantPartFactory extends IPartFactory
|
|||
|
||||
def create[C <: TMultiPart](part: Class[C]): C = MultiPartRegistry.createPart((partMap map (_.swap)).get(part).get, false).asInstanceOf[C]
|
||||
|
||||
def init() = MultiPartRegistry.registerParts(this, partMap.keys.toArray)
|
||||
def init()
|
||||
{
|
||||
MultiPartRegistry.registerParts(this, partMap.keys.toArray)
|
||||
|
||||
MultipartGenerator.registerTrait("universalelectricity.api.core.grid.INodeProvider", "resonantinduction.core.prefab.TNodeProvider")
|
||||
}
|
||||
|
||||
def createPart(name: String, client: Boolean): TMultiPart = partMap(name).newInstance()
|
||||
}
|
||||
|
|
|
@ -73,11 +73,11 @@ class PartFlatWire extends TWire with TFacePart with TNormalOcclusion
|
|||
|
||||
override lazy val node = new FlatWireNode(this)
|
||||
|
||||
|
||||
def preparePlacement(side: Int, meta: Int)
|
||||
{
|
||||
this.side = (side ^ 1).toByte
|
||||
setMaterial(meta)
|
||||
node.setResistance(material.resistance)
|
||||
}
|
||||
|
||||
def canStay: Boolean =
|
||||
|
|
|
@ -5,9 +5,14 @@ import net.minecraft.init.Items;
|
|||
import resonant.content.loader.ModManager;
|
||||
import resonant.engine.content.debug.TileCreativeBuilder;
|
||||
import resonant.lib.network.discriminator.PacketAnnotationManager;
|
||||
import resonantinduction.core.ResonantPartFactory;
|
||||
import resonantinduction.core.ResonantPartFactory$;
|
||||
import resonantinduction.core.ResonantTab;
|
||||
import resonantinduction.mechanical.energy.grid.MechanicalNode;
|
||||
import resonantinduction.mechanical.fluid.pipe.PartPipe;
|
||||
import resonantinduction.mechanical.fluid.pipe.PipeMaterials;
|
||||
import resonantinduction.mechanical.gear.PartGear;
|
||||
import resonantinduction.mechanical.gearshaft.PartGearShaft;
|
||||
import resonantinduction.mechanical.turbine.*;
|
||||
import resonantinduction.mechanical.fluid.pipe.ItemPipe;
|
||||
import resonantinduction.mechanical.fluid.transport.TilePump;
|
||||
|
@ -127,12 +132,15 @@ public class Mechanical
|
|||
|
||||
PacketAnnotationManager.INSTANCE.register(TileWindTurbine.class);
|
||||
PacketAnnotationManager.INSTANCE.register(TileWaterTurbine.class);
|
||||
|
||||
ResonantPartFactory$.MODULE$.register(PartGear.class);
|
||||
ResonantPartFactory$.MODULE$.register(PartGearShaft.class);
|
||||
ResonantPartFactory$.MODULE$.register(PartPipe.class);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent evt)
|
||||
{
|
||||
MultipartMechanical.INSTANCE = new MultipartMechanical();
|
||||
proxy.init();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
package resonantinduction.mechanical;
|
||||
|
||||
import resonantinduction.mechanical.fluid.pipe.PartPipe;
|
||||
import resonantinduction.mechanical.gear.PartGear;
|
||||
import resonantinduction.mechanical.gearshaft.PartGearShaft;
|
||||
import codechicken.multipart.MultiPartRegistry;
|
||||
import codechicken.multipart.MultiPartRegistry.IPartFactory;
|
||||
import codechicken.multipart.MultipartGenerator;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
|
||||
public class MultipartMechanical implements IPartFactory
|
||||
{
|
||||
public static MultipartMechanical INSTANCE;
|
||||
|
||||
public static final String[] PART_TYPES = { "resonant_induction_gear", "resonant_induction_gear_shaft", "resonant_induction_pipe" };
|
||||
|
||||
public MultipartMechanical()
|
||||
{
|
||||
MultiPartRegistry.registerParts(this, PART_TYPES);
|
||||
//MultipartGenerator.registerPassThroughInterface("resonantinduction.core.grid.fluid.IPressureNodeProvider");
|
||||
// TODO: Move to UE
|
||||
MultipartGenerator.registerTrait("universalelectricity.api.core.grid.INodeProvider", "resonantinduction.core.prefab.TraitNodeProvider");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TMultiPart createPart(String name, boolean client)
|
||||
{
|
||||
if (name.equals("resonant_induction_gear"))
|
||||
{
|
||||
return new PartGear();
|
||||
}
|
||||
else if (name.equals("resonant_induction_gear_shaft"))
|
||||
{
|
||||
return new PartGearShaft();
|
||||
}
|
||||
else if (name.equals("resonant_induction_pipe"))
|
||||
{
|
||||
return new PartPipe();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue