Added insulation ability and color
This commit is contained in:
parent
34881cb453
commit
bf0eee7058
5 changed files with 136 additions and 64 deletions
|
@ -9,6 +9,8 @@ import net.minecraft.world.World;
|
||||||
import resonantinduction.multimeter.ContainerMultimeter;
|
import resonantinduction.multimeter.ContainerMultimeter;
|
||||||
import resonantinduction.multimeter.TileEntityMultimeter;
|
import resonantinduction.multimeter.TileEntityMultimeter;
|
||||||
import universalelectricity.api.vector.Vector3;
|
import universalelectricity.api.vector.Vector3;
|
||||||
|
import codechicken.lib.colour.Colour;
|
||||||
|
import codechicken.lib.colour.ColourRGBA;
|
||||||
import cpw.mods.fml.common.network.IGuiHandler;
|
import cpw.mods.fml.common.network.IGuiHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,10 +33,12 @@ public class CommonProxy implements IGuiHandler
|
||||||
{
|
{
|
||||||
return new ContainerMultimeter(player.inventory, ((TileEntityMultimeter) tileEntity));
|
return new ContainerMultimeter(player.inventory, ((TileEntityMultimeter) tileEntity));
|
||||||
}
|
}
|
||||||
/*else if (tileEntity instanceof TileEntityBattery)
|
/*
|
||||||
{
|
* else if (tileEntity instanceof TileEntityBattery)
|
||||||
return new ContainerBattery(player.inventory, ((TileEntityBattery) tileEntity));
|
* {
|
||||||
}*/
|
* return new ContainerBattery(player.inventory, ((TileEntityBattery) tileEntity));
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -60,14 +64,14 @@ public class CommonProxy implements IGuiHandler
|
||||||
this.renderElectricShock(world, start, target, r, g, b, true);
|
this.renderElectricShock(world, start, target, r, g, b, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderElectricShock(World world, Vector3 start, Vector3 target, Vector3 color)
|
public void renderElectricShock(World world, Vector3 start, Vector3 target, ColourRGBA color)
|
||||||
{
|
{
|
||||||
this.renderElectricShock(world, start, target, (float) color.x, (float) color.y, (float) color.z);
|
this.renderElectricShock(world, start, target, color.r / 255, color.g / 255, color.b / 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderElectricShock(World world, Vector3 start, Vector3 target, Vector3 color, boolean split)
|
public void renderElectricShock(World world, Vector3 start, Vector3 target, ColourRGBA color, boolean split)
|
||||||
{
|
{
|
||||||
this.renderElectricShock(world, start, target, (float) color.x, (float) color.y, (float) color.z, split);
|
this.renderElectricShock(world, start, target, color.r / 255, color.g / 255, color.b / 255, split);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderElectricShock(World world, Vector3 start, Vector3 target)
|
public void renderElectricShock(World world, Vector3 start, Vector3 target)
|
||||||
|
|
|
@ -20,6 +20,7 @@ import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||||
import org.modstats.ModstatInfo;
|
import org.modstats.ModstatInfo;
|
||||||
import org.modstats.Modstats;
|
import org.modstats.Modstats;
|
||||||
|
|
||||||
|
import codechicken.lib.colour.ColourRGBA;
|
||||||
import resonantinduction.contractor.BlockEMContractor;
|
import resonantinduction.contractor.BlockEMContractor;
|
||||||
import resonantinduction.contractor.ItemBlockContractor;
|
import resonantinduction.contractor.ItemBlockContractor;
|
||||||
import resonantinduction.contractor.TileEntityEMContractor;
|
import resonantinduction.contractor.TileEntityEMContractor;
|
||||||
|
@ -152,8 +153,7 @@ public class ResonantInduction
|
||||||
* Packets
|
* Packets
|
||||||
*/
|
*/
|
||||||
public static final PacketTile PACKET_TILE = new PacketTile(CHANNEL);
|
public static final PacketTile PACKET_TILE = new PacketTile(CHANNEL);
|
||||||
|
public static final ColourRGBA[] DYE_COLORS = new ColourRGBA[] { new ColourRGBA(255, 255, 255, 255), new ColourRGBA(1, 0, 0, 1d), new ColourRGBA(0, 0.608, 0.232, 1d), new ColourRGBA(0.588, 0.294, 0, 1d), new ColourRGBA(0, 0, 1, 1d), new ColourRGBA(0.5, 0, 05, 1d), new ColourRGBA(0, 1, 1, 1d), new ColourRGBA(0.8, 0.8, 0.8, 1d), new ColourRGBA(0.3, 0.3, 0.3, 1d), new ColourRGBA(1, 0.412, 0.706, 1d), new ColourRGBA(0.616, 1, 0, 1d), new ColourRGBA(1, 1, 0, 1d), new ColourRGBA(0.46f, 0.932, 1, 1d), new ColourRGBA(0.5, 0.2, 0.5, 1d), new ColourRGBA(0.7, 0.5, 0.1, 1d), new ColourRGBA(1, 1, 1, 1d) };
|
||||||
public static final Vector3[] DYE_COLORS = new Vector3[] { new Vector3(), new Vector3(1, 0, 0), new Vector3(0, 0.608, 0.232), new Vector3(0.588, 0.294, 0), new Vector3(0, 0, 1), new Vector3(0.5, 0, 05), new Vector3(0, 1, 1), new Vector3(0.8, 0.8, 0.8), new Vector3(0.3, 0.3, 0.3), new Vector3(1, 0.412, 0.706), new Vector3(0.616, 1, 0), new Vector3(1, 1, 0), new Vector3(0.46f, 0.932, 1), new Vector3(0.5, 0.2, 0.5), new Vector3(0.7, 0.5, 0.1), new Vector3(1, 1, 1) };
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent evt)
|
public void preInit(FMLPreInitializationEvent evt)
|
||||||
|
|
|
@ -214,7 +214,7 @@ public class TileEntityTesla extends TileEntityElectrical implements ITesla, IPa
|
||||||
}
|
}
|
||||||
|
|
||||||
double distance = topTeslaVector.distance(targetVector);
|
double distance = topTeslaVector.distance(targetVector);
|
||||||
ResonantInduction.proxy.renderElectricShock(this.worldObj, new Vector3(topTesla).translate(new Vector3(0.5)), targetVector.translate(new Vector3(0.5)), (float) ResonantInduction.DYE_COLORS[this.dyeID].x, (float) ResonantInduction.DYE_COLORS[this.dyeID].y, (float) ResonantInduction.DYE_COLORS[this.dyeID].z);
|
ResonantInduction.proxy.renderElectricShock(this.worldObj, new Vector3(topTesla).translate(new Vector3(0.5)), targetVector.translate(new Vector3(0.5)), (float) ResonantInduction.DYE_COLORS[this.dyeID].r / 255, (float) ResonantInduction.DYE_COLORS[this.dyeID].g / 255, (float) ResonantInduction.DYE_COLORS[this.dyeID].b / 255);
|
||||||
|
|
||||||
this.transfer(tesla, Math.min(transferEnergy, TRANSFER_CAP));
|
this.transfer(tesla, Math.min(transferEnergy, TRANSFER_CAP));
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,8 @@ import codechicken.lib.data.MCDataOutput;
|
||||||
public abstract class PartAdvancedWire extends PartConductor
|
public abstract class PartAdvancedWire extends PartConductor
|
||||||
{
|
{
|
||||||
public static final int DEFAULT_COLOR = 16;
|
public static final int DEFAULT_COLOR = 16;
|
||||||
public int dyeID = DEFAULT_COLOR;
|
public int color = DEFAULT_COLOR;
|
||||||
|
|
||||||
public EnumWireMaterial material = EnumWireMaterial.COPPER;
|
public EnumWireMaterial material = EnumWireMaterial.COPPER;
|
||||||
public boolean isInsulated = false;
|
public boolean isInsulated = false;
|
||||||
|
|
||||||
|
@ -39,8 +40,9 @@ public abstract class PartAdvancedWire extends PartConductor
|
||||||
{
|
{
|
||||||
PartFlatWire wire = (PartFlatWire) obj;
|
PartFlatWire wire = (PartFlatWire) obj;
|
||||||
|
|
||||||
if (wire.getMaterial() == getMaterial())
|
if (this.getMaterial() == wire.getMaterial())
|
||||||
{
|
{
|
||||||
|
System.out.println("COMMON");
|
||||||
if (this.isInsulated() && wire.isInsulated())
|
if (this.isInsulated() && wire.isInsulated())
|
||||||
{
|
{
|
||||||
return this.getColor() == wire.getColor();
|
return this.getColor() == wire.getColor();
|
||||||
|
@ -97,14 +99,26 @@ public abstract class PartAdvancedWire extends PartConductor
|
||||||
public void setInsulated(boolean insulated)
|
public void setInsulated(boolean insulated)
|
||||||
{
|
{
|
||||||
this.isInsulated = insulated;
|
this.isInsulated = insulated;
|
||||||
this.dyeID = DEFAULT_COLOR;
|
this.color = DEFAULT_COLOR;
|
||||||
|
|
||||||
|
if (!this.world().isRemote)
|
||||||
|
{
|
||||||
|
tile().notifyPartChange(this);
|
||||||
|
this.sendInsulationUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInsulated(int dyeColour)
|
public void setInsulated(int dyeColour)
|
||||||
{
|
{
|
||||||
isInsulated = true;
|
this.isInsulated = true;
|
||||||
dyeID = dyeColour;
|
this.color = dyeColour;
|
||||||
|
|
||||||
|
if (!this.world().isRemote)
|
||||||
|
{
|
||||||
tile().notifyPartChange(this);
|
tile().notifyPartChange(this);
|
||||||
|
this.sendInsulationUpdate();
|
||||||
|
this.sendColorUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInsulated()
|
public boolean isInsulated()
|
||||||
|
@ -112,51 +126,78 @@ public abstract class PartAdvancedWire extends PartConductor
|
||||||
return this.isInsulated;
|
return this.isInsulated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void sendInsulationUpdate()
|
||||||
|
{
|
||||||
|
tile().getWriteStream(this).writeByte(1).writeBoolean(this.isInsulated);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wire Coloring Methods
|
* Wire Coloring Methods
|
||||||
*/
|
*/
|
||||||
public int getColor()
|
public int getColor()
|
||||||
{
|
{
|
||||||
return this.isInsulated ? this.dyeID : -1;
|
return this.isInsulated ? this.color : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setColor(int dye)
|
public void setColor(int dye)
|
||||||
{
|
{
|
||||||
this.dyeID = dye;
|
if (this.isInsulated)
|
||||||
|
{
|
||||||
|
this.color = dye;
|
||||||
|
|
||||||
|
if (!this.world().isRemote)
|
||||||
|
{
|
||||||
|
tile().notifyPartChange(this);
|
||||||
|
this.sendColorUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendColorUpdate()
|
||||||
|
{
|
||||||
|
tile().getWriteStream(this).writeByte(2).writeInt(this.color);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the wire's color.
|
* Changes the wire's color.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean activate(EntityPlayer player, MovingObjectPosition part, ItemStack item)
|
public boolean activate(EntityPlayer player, MovingObjectPosition part, ItemStack itemStack)
|
||||||
{
|
{
|
||||||
if (item != null)
|
if (itemStack != null)
|
||||||
{
|
{
|
||||||
if (item.itemID == Item.dyePowder.itemID && isInsulated())
|
if (itemStack.itemID == Item.dyePowder.itemID && this.isInsulated())
|
||||||
{
|
{
|
||||||
setColor(item.getItemDamage());
|
this.setColor(itemStack.getItemDamage());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (item.itemID == Block.cloth.blockID)
|
else if (itemStack.itemID == Block.cloth.blockID)
|
||||||
{
|
{
|
||||||
if (isInsulated() && !world().isRemote)
|
if (this.isInsulated())
|
||||||
{
|
|
||||||
tile().dropItems(Collections.singletonList(new ItemStack(Block.cloth, 1, BlockColored.getBlockFromDye(dyeID))));
|
|
||||||
}
|
|
||||||
|
|
||||||
setInsulated(BlockColored.getDyeFromBlock(item.getItemDamage()));
|
|
||||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if ((item.itemID == Item.shears.itemID || item.getItem() instanceof ItemShears) && isInsulated())
|
|
||||||
{
|
{
|
||||||
if (!world().isRemote)
|
if (!world().isRemote)
|
||||||
{
|
{
|
||||||
tile().dropItems(Collections.singletonList(new ItemStack(Block.cloth, 1, BlockColored.getBlockFromDye(dyeID))));
|
tile().dropItems(Collections.singletonList(new ItemStack(Block.cloth, 1, BlockColored.getBlockFromDye(color))));
|
||||||
}
|
}
|
||||||
|
|
||||||
setInsulated(false);
|
this.setInsulated(false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.setInsulated(BlockColored.getDyeFromBlock(itemStack.getItemDamage()));
|
||||||
|
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ((itemStack.itemID == Item.shears.itemID || itemStack.getItem() instanceof ItemShears) && isInsulated())
|
||||||
|
{
|
||||||
|
if (!world().isRemote)
|
||||||
|
{
|
||||||
|
tile().dropItems(Collections.singletonList(new ItemStack(Block.cloth, 1, BlockColored.getBlockFromDye(color))));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setInsulated(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -177,7 +218,7 @@ public abstract class PartAdvancedWire extends PartConductor
|
||||||
|
|
||||||
if (this.isInsulated)
|
if (this.isInsulated)
|
||||||
{
|
{
|
||||||
drops.add(new ItemStack(Block.cloth, 1, BlockColored.getBlockFromDye(dyeID)));
|
drops.add(new ItemStack(Block.cloth, 1, BlockColored.getBlockFromDye(color)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return drops;
|
return drops;
|
||||||
|
@ -193,7 +234,7 @@ public abstract class PartAdvancedWire extends PartConductor
|
||||||
public void readDesc(MCDataInput packet)
|
public void readDesc(MCDataInput packet)
|
||||||
{
|
{
|
||||||
this.setMaterial(packet.readByte());
|
this.setMaterial(packet.readByte());
|
||||||
this.dyeID = packet.readByte();
|
this.color = packet.readByte();
|
||||||
this.isInsulated = packet.readBoolean();
|
this.isInsulated = packet.readBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,17 +242,32 @@ public abstract class PartAdvancedWire extends PartConductor
|
||||||
public void writeDesc(MCDataOutput packet)
|
public void writeDesc(MCDataOutput packet)
|
||||||
{
|
{
|
||||||
packet.writeByte((byte) this.getMaterialID());
|
packet.writeByte((byte) this.getMaterialID());
|
||||||
packet.writeByte((byte) this.dyeID);
|
packet.writeByte((byte) this.color);
|
||||||
packet.writeBoolean(this.isInsulated);
|
packet.writeBoolean(this.isInsulated);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void read(MCDataInput packet, int packetID)
|
||||||
|
{
|
||||||
|
switch (packetID)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
this.isInsulated = packet.readBoolean();
|
||||||
|
this.tile().markRender();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
this.color = packet.readInt();
|
||||||
|
this.tile().markRender();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void save(NBTTagCompound nbt)
|
public void save(NBTTagCompound nbt)
|
||||||
{
|
{
|
||||||
super.save(nbt);
|
super.save(nbt);
|
||||||
nbt.setInteger("typeID", getMaterialID());
|
nbt.setInteger("typeID", getMaterialID());
|
||||||
nbt.setBoolean("isInsulated", isInsulated);
|
nbt.setBoolean("isInsulated", isInsulated);
|
||||||
nbt.setInteger("dyeID", dyeID);
|
nbt.setInteger("dyeID", color);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -220,7 +276,7 @@ public abstract class PartAdvancedWire extends PartConductor
|
||||||
super.load(nbt);
|
super.load(nbt);
|
||||||
setMaterial(nbt.getInteger("typeID"));
|
setMaterial(nbt.getInteger("typeID"));
|
||||||
this.isInsulated = nbt.getBoolean("isInsulated");
|
this.isInsulated = nbt.getBoolean("isInsulated");
|
||||||
this.dyeID = nbt.getInteger("dyeID");
|
this.color = nbt.getInteger("dyeID");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.util.Arrays;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.RenderBlocks;
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemDye;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
@ -13,10 +14,12 @@ import net.minecraftforge.common.ForgeDirection;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import resonantinduction.ResonantInduction;
|
||||||
import resonantinduction.Utility;
|
import resonantinduction.Utility;
|
||||||
import resonantinduction.wire.EnumWireMaterial;
|
import resonantinduction.wire.EnumWireMaterial;
|
||||||
import resonantinduction.wire.render.RenderFlatWire;
|
import resonantinduction.wire.render.RenderFlatWire;
|
||||||
import codechicken.lib.colour.Colour;
|
import codechicken.lib.colour.Colour;
|
||||||
|
import codechicken.lib.colour.ColourRGBA;
|
||||||
import codechicken.lib.data.MCDataInput;
|
import codechicken.lib.data.MCDataInput;
|
||||||
import codechicken.lib.data.MCDataOutput;
|
import codechicken.lib.data.MCDataOutput;
|
||||||
import codechicken.lib.lighting.LazyLightMatrix;
|
import codechicken.lib.lighting.LazyLightMatrix;
|
||||||
|
@ -101,7 +104,7 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
||||||
public void preparePlacement(int side, int meta)
|
public void preparePlacement(int side, int meta)
|
||||||
{
|
{
|
||||||
this.side = (byte) (side ^ 1);
|
this.side = (byte) (side ^ 1);
|
||||||
this.material = EnumWireMaterial.values()[meta];
|
this.setMaterial(meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -145,6 +148,7 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
||||||
read(packet, packet.readUByte());
|
read(packet, packet.readUByte());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void read(MCDataInput packet, int packetID)
|
public void read(MCDataInput packet, int packetID)
|
||||||
{
|
{
|
||||||
if (packetID == 0)
|
if (packetID == 0)
|
||||||
|
@ -152,6 +156,10 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
||||||
this.connMap = packet.readInt();
|
this.connMap = packet.readInt();
|
||||||
tile().markRender();
|
tile().markRender();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
super.read(packet, packetID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendConnUpdate()
|
public void sendConnUpdate()
|
||||||
|
@ -237,7 +245,6 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
||||||
{
|
{
|
||||||
if (!world().isRemote)
|
if (!world().isRemote)
|
||||||
{
|
{
|
||||||
|
|
||||||
boolean changed = updateInternalConnections();
|
boolean changed = updateInternalConnections();
|
||||||
|
|
||||||
if (updateOpenConnections())
|
if (updateOpenConnections())
|
||||||
|
@ -294,29 +301,13 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
||||||
*/
|
*/
|
||||||
for (byte r = 0; r < 4; r++)
|
for (byte r = 0; r < 4; r++)
|
||||||
{
|
{
|
||||||
int absDir = Rotation.rotateSide(this.side, r);
|
if (!maskOpen(r))
|
||||||
this.setExternalConnection(absDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Connect to the face of the block the wire is placed on.
|
|
||||||
this.setExternalConnection(this.side);
|
|
||||||
|
|
||||||
for (byte r = 0; r < 4; r++)
|
|
||||||
{
|
{
|
||||||
int absDir = Rotation.rotateSide(this.side, r);
|
|
||||||
|
|
||||||
// Check straight ahead.
|
|
||||||
if (tile().partMap(PartMap.edgeBetween(absDir, this.side)) == null)
|
|
||||||
{
|
|
||||||
TMultiPart tp = tile().partMap(absDir);
|
|
||||||
|
|
||||||
if (this.canConnectTo(tp))
|
|
||||||
{
|
|
||||||
this.connections[absDir] = tp;
|
|
||||||
this.getNetwork().merge(((PartFlatWire) tp).getNetwork());
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
int absDir = Rotation.rotateSide(this.side, r);
|
||||||
|
this.setExternalConnection(absDir);
|
||||||
|
|
||||||
// Check Corner
|
// Check Corner
|
||||||
BlockCoord cornerPos = new BlockCoord(tile());
|
BlockCoord cornerPos = new BlockCoord(tile());
|
||||||
|
@ -338,11 +329,32 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
||||||
this.getNetwork().merge(((PartFlatWire) tp).getNetwork());
|
this.getNetwork().merge(((PartFlatWire) tp).getNetwork());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (byte r = 0; r < 4; r++)
|
||||||
|
{
|
||||||
|
int absDir = Rotation.rotateSide(this.side, r);
|
||||||
|
|
||||||
|
// Check straight ahead.
|
||||||
|
if (tile().partMap(PartMap.edgeBetween(absDir, this.side)) == null)
|
||||||
|
{
|
||||||
|
TMultiPart tp = tile().partMap(absDir);
|
||||||
|
|
||||||
|
if (this.canConnectTo(tp))
|
||||||
|
{
|
||||||
|
this.connections[absDir] = tp;
|
||||||
|
this.getNetwork().merge(((PartFlatWire) tp).getNetwork());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Cannot find any wire connections on this side. Set null.
|
// Cannot find any wire connections on this side. Set null.
|
||||||
this.connections[absDir] = null;
|
this.connections[absDir] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Connect to the face of the block the wire is placed on.
|
||||||
|
this.setExternalConnection(this.side);
|
||||||
|
|
||||||
this.getNetwork().reconstruct();
|
this.getNetwork().reconstruct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -541,14 +553,14 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
||||||
{
|
{
|
||||||
TMultiPart tp = t.partMap(absDir ^ 1);
|
TMultiPart tp = t.partMap(absDir ^ 1);
|
||||||
|
|
||||||
if (tp instanceof PartFlatWire)
|
if (canConnectTo(tp))
|
||||||
{
|
{
|
||||||
boolean b = ((PartFlatWire) tp).connectCorner(this, Rotation.rotationTo(absDir ^ 1, side ^ 1));
|
boolean b = ((PartFlatWire) tp).connectCorner(this, Rotation.rotationTo(absDir ^ 1, side ^ 1));
|
||||||
|
|
||||||
if (b)
|
if (b)
|
||||||
{
|
{
|
||||||
// let them connect to us
|
// let them connect to us
|
||||||
if (tp instanceof PartFlatWire && !renderThisCorner((PartFlatWire) tp))
|
if (!renderThisCorner((PartFlatWire) tp))
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -785,7 +797,7 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
||||||
|
|
||||||
public Colour getColour()
|
public Colour getColour()
|
||||||
{
|
{
|
||||||
return this.getMaterial().color;
|
return this.isInsulated ? ResonantInduction.DYE_COLORS[this.color] : this.getMaterial().color;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean useStaticRenderer()
|
public boolean useStaticRenderer()
|
||||||
|
|
Loading…
Reference in a new issue