The standalone wires render! :D
This commit is contained in:
parent
cb9d7a60cb
commit
0122b481a8
5 changed files with 132 additions and 105 deletions
|
@ -4,6 +4,7 @@ import resonantinduction.multimeter.PartMultimeter;
|
|||
import resonantinduction.transformer.PartTransformer;
|
||||
import resonantinduction.wire.flat.PartFlatSwitchWire;
|
||||
import resonantinduction.wire.flat.PartFlatWire;
|
||||
import resonantinduction.wire.framed.PartWire;
|
||||
import codechicken.multipart.MultiPartRegistry;
|
||||
import codechicken.multipart.MultiPartRegistry.IPartFactory;
|
||||
import codechicken.multipart.MultipartGenerator;
|
||||
|
@ -13,9 +14,17 @@ public class MultipartRI implements IPartFactory
|
|||
{
|
||||
public static MultipartRI INSTANCE;
|
||||
|
||||
public static final String[] PART_TYPES = {
|
||||
"resonant_induction_wire",
|
||||
"resonant_induction_flat_wire",
|
||||
"resonant_induction_flat_switch_wire",
|
||||
"resonant_induction_multimeter",
|
||||
"resonant_induction_transformer"
|
||||
};
|
||||
|
||||
public MultipartRI()
|
||||
{
|
||||
MultiPartRegistry.registerParts(this, new String[] { "resonant_induction_flat_wire", "resonant_induction_flat_switch_wire", "resonant_induction_multimeter", "resonant_induction_transformer" });
|
||||
MultiPartRegistry.registerParts(this, PART_TYPES);
|
||||
MultipartGenerator.registerTrait("universalelectricity.api.energy.IConductor", "resonantinduction.wire.trait.TraitConductor");
|
||||
MultipartGenerator.registerTrait("cofh.api.energy.IEnergyHandler", "resonantinduction.wire.trait.TraitEnergyHandler");
|
||||
MultipartGenerator.registerTrait("ic2.api.energy.tile.IEnergySink", "resonantinduction.wire.trait.TraitEnergySink");
|
||||
|
@ -24,20 +33,21 @@ public class MultipartRI implements IPartFactory
|
|||
@Override
|
||||
public TMultiPart createPart(String name, boolean client)
|
||||
{
|
||||
if (name.equals("resonant_induction_flat_wire"))
|
||||
switch(name)
|
||||
{
|
||||
case "resonant_induction_wire":
|
||||
return new PartWire();
|
||||
|
||||
case "resonant_induction_flat_wire":
|
||||
return new PartFlatWire();
|
||||
}
|
||||
else if(name.equals("resonant_induction_flat_switch_wire"))
|
||||
{
|
||||
|
||||
case "resonant_induction_flat_switch_wire":
|
||||
return new PartFlatSwitchWire();
|
||||
}
|
||||
else if (name.equals("resonant_induction_multimeter"))
|
||||
{
|
||||
|
||||
case "resonant_induction_multimeter":
|
||||
return new PartMultimeter();
|
||||
}
|
||||
else if (name.equals("resonant_induction_transformer"))
|
||||
{
|
||||
|
||||
case "resonant_induction_transformer":
|
||||
return new PartTransformer();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,12 +18,15 @@ import resonantinduction.TabRI;
|
|||
import resonantinduction.Utility;
|
||||
import resonantinduction.wire.flat.PartFlatWire;
|
||||
import resonantinduction.wire.flat.RenderFlatWire;
|
||||
import resonantinduction.wire.framed.PartWire;
|
||||
import resonantinduction.wire.framed.RenderPartWire;
|
||||
import universalelectricity.api.energy.UnitDisplay;
|
||||
import universalelectricity.api.energy.UnitDisplay.Unit;
|
||||
import calclavia.lib.Calclavia;
|
||||
import calclavia.lib.render.EnumColor;
|
||||
import codechicken.lib.vec.BlockCoord;
|
||||
import codechicken.lib.vec.Vector3;
|
||||
import codechicken.multipart.ControlKeyModifer;
|
||||
import codechicken.multipart.JItemMultiPart;
|
||||
import codechicken.multipart.MultiPartRegistry;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
|
@ -48,6 +51,19 @@ public class ItemWire extends JItemMultiPart
|
|||
{
|
||||
BlockCoord onPos = pos.copy().offset(side ^ 1);
|
||||
|
||||
if (ControlKeyModifer.isControlDown(player))
|
||||
{
|
||||
PartWire wire = (PartWire) MultiPartRegistry.createPart("resonant_induction_wire", false);
|
||||
|
||||
if (wire != null)
|
||||
{
|
||||
wire.preparePlacement(itemStack.getItemDamage());
|
||||
}
|
||||
|
||||
return wire;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Utility.canPlaceWireOnSide(world, onPos.x, onPos.y, onPos.z, ForgeDirection.getOrientation(side), false))
|
||||
{
|
||||
return null;
|
||||
|
@ -62,6 +78,7 @@ public class ItemWire extends JItemMultiPart
|
|||
|
||||
return wire;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage)
|
||||
|
@ -107,6 +124,8 @@ public class ItemWire extends JItemMultiPart
|
|||
}
|
||||
|
||||
RenderFlatWire.flatWireTexture = register.registerIcon(ResonantInduction.PREFIX + "models/flatWire");
|
||||
RenderPartWire.wireIcon = register.registerIcon(ResonantInduction.PREFIX + "models/wire");
|
||||
RenderPartWire.insulationIcon = register.registerIcon(ResonantInduction.PREFIX + "models/insulation" + (ResonantInduction.LO_FI_INSULATION ? "tiny" : ""));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -116,6 +116,11 @@ public class PartWire extends PartAdvancedWire implements TSlottedPart, JNormalO
|
|||
return subParts;
|
||||
}
|
||||
|
||||
public void preparePlacement(int meta)
|
||||
{
|
||||
this.setMaterial(meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Cuboid6> getCollisionBoxes()
|
||||
{
|
||||
|
@ -272,13 +277,8 @@ public class PartWire extends PartAdvancedWire implements TSlottedPart, JNormalO
|
|||
*/
|
||||
public boolean isConnectionPrevented(TileEntity tile, ForgeDirection side)
|
||||
{
|
||||
return (tile instanceof IConductor ? this.canConnectTo((IConductor) tile) : false) || (isBlockedOnSide(side));// ||
|
||||
// tile
|
||||
// instanceof
|
||||
// IBlockableConnection
|
||||
// &&
|
||||
// ((IBlockableConnection)
|
||||
// tile).isBlockedOnSide(side.getOpposite()))*/;
|
||||
return (tile instanceof IConductor ? this.canConnectTo((IConductor) tile) : false) || (isBlockedOnSide(side));
|
||||
// || tile instanceof IBlockableConnection && ((IBlockableConnection) tile).isBlockedOnSide(side.getOpposite()))*/;
|
||||
}
|
||||
|
||||
public byte getPossibleWireConnections()
|
||||
|
|
|
@ -133,9 +133,7 @@ public class RenderPartWire
|
|||
|
||||
public static void registerIcons(IconRegister iconReg)
|
||||
{
|
||||
wireIcon = iconReg.registerIcon(ResonantInduction.PREFIX + "models/wire");
|
||||
lainWireIcon = iconReg.registerIcon(ResonantInduction.PREFIX + "models/lainWire");
|
||||
insulationIcon = iconReg.registerIcon(ResonantInduction.PREFIX + "models/insulation" + (ResonantInduction.LO_FI_INSULATION ? "tiny" : ""));
|
||||
breakIcon = iconReg.registerIcon(ResonantInduction.PREFIX + "wire");
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3 KiB |
Loading…
Reference in a new issue