Tweaked material specialty
This commit is contained in:
parent
6056a2215a
commit
1743f428c4
5 changed files with 43 additions and 34 deletions
|
@ -16,10 +16,18 @@ import codechicken.lib.colour.ColourRGBA;
|
|||
|
||||
public enum EnumWireMaterial
|
||||
{
|
||||
COPPER("Copper", 12.5F, 3, 20, 184, 115, 51), TIN("Tin", 13, 2, 5, 132, 132, 130),
|
||||
IRON("Iron", 0.1F, 20, 40, 97, 102, 105), ALUMINUM("Aluminum", 0.025F, 6, 150, 215, 205, 181),
|
||||
SILVER("Silver", 5F, 1, 20, 192, 192, 192),
|
||||
SUPERCONDUCTOR("Superconductor", 0, 1, 100, 255, 255, 1);
|
||||
/** Copper: General. */
|
||||
COPPER("Copper", 1.68f, 5, 10, 184, 115, 51),
|
||||
/** Tin: Low shock, cheap */
|
||||
TIN("Tin", 11f, 1, 5, 132, 132, 130),
|
||||
/** Iron: High Capacity */
|
||||
IRON("Iron", 10f, 3, 80, 97, 102, 105),
|
||||
/** Aluminum: High Shock */
|
||||
ALUMINUM("Aluminum", 2.82f, 10, 70, 215, 205, 181),
|
||||
/** Aluminum: Low Resistance */
|
||||
SILVER("Silver", 1.59f, 5, 20, 192, 192, 192),
|
||||
/** Superconductor: Over-powered */
|
||||
SUPERCONDUCTOR("Superconductor", 0, 10, 200, 255, 255, 1);
|
||||
|
||||
public final float resistance;
|
||||
public final int damage;
|
||||
|
@ -28,13 +36,14 @@ public enum EnumWireMaterial
|
|||
private ItemStack wire;
|
||||
private final String name;
|
||||
|
||||
private EnumWireMaterial(String s, float resist, int electrocution, long max, int r, int g, int b)
|
||||
private EnumWireMaterial(String name, float resistance, int electrocutionDamage, long maxAmps, int r, int g, int b)
|
||||
{
|
||||
name = s;
|
||||
resistance = resist;
|
||||
damage = electrocution;
|
||||
maxAmps = max;
|
||||
color = new ColourRGBA(r, g, b, 255);
|
||||
this.name = name;
|
||||
/** Multiply the realistic resistance by a factor for game balance. */
|
||||
this.resistance = resistance * 2;
|
||||
this.damage = electrocutionDamage;
|
||||
this.maxAmps = maxAmps;
|
||||
this.color = new ColourRGBA(r, g, b, 255);
|
||||
}
|
||||
|
||||
public String getName()
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import calclavia.lib.prefab.CustomDamageSource;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockColored;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
@ -14,9 +13,11 @@ import net.minecraft.item.ItemShears;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import resonantinduction.ResonantInduction;
|
||||
import resonantinduction.wire.EnumWireMaterial;
|
||||
import universalelectricity.api.CompatibilityModule;
|
||||
import universalelectricity.api.UniversalElectricity;
|
||||
import universalelectricity.api.energy.IConductor;
|
||||
import calclavia.lib.prefab.CustomDamageSource;
|
||||
import codechicken.lib.data.MCDataInput;
|
||||
import codechicken.lib.data.MCDataOutput;
|
||||
|
||||
|
@ -53,7 +54,7 @@ public abstract class PartAdvancedWire extends PartConductor
|
|||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (!(obj instanceof IConductor))
|
||||
{
|
||||
return CompatibilityModule.isHandler(obj);
|
||||
}
|
||||
|
@ -71,18 +72,15 @@ public abstract class PartAdvancedWire extends PartConductor
|
|||
}
|
||||
|
||||
@Override
|
||||
public long getEnergyLoss()
|
||||
public float getResistance()
|
||||
{
|
||||
/**
|
||||
* TODO: FIX THIS!
|
||||
*/
|
||||
return (int) (this.getMaterial().resistance * 10);
|
||||
return this.getMaterial().resistance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEnergyCapacitance()
|
||||
public long getTransferCapacity()
|
||||
{
|
||||
return this.getMaterial().maxAmps * 1000;
|
||||
return this.getMaterial().maxAmps * UniversalElectricity.DEFAULT_VOLTAGE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,7 +22,7 @@ public abstract class PartConductor extends PartAdvanced implements IConductor
|
|||
*/
|
||||
@Override
|
||||
public long onReceiveEnergy(ForgeDirection from, long receive, boolean doReceive)
|
||||
{System.out.println("RECEIVE");
|
||||
{
|
||||
return this.getNetwork().produce(new Vector3(tile()).modifyPositionFromSide(from).getTileEntity(world()), from.getOpposite(), receive, doReceive);
|
||||
}
|
||||
|
||||
|
|
|
@ -300,17 +300,12 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
|||
*/
|
||||
for (byte r = 0; r < 4; r++)
|
||||
{
|
||||
boolean didConnect = false;
|
||||
|
||||
int absDir = Rotation.rotateSide(this.side, r);
|
||||
|
||||
if (maskOpen(r))
|
||||
{
|
||||
int absDir = Rotation.rotateSide(this.side, r);
|
||||
|
||||
// Check direct connection.
|
||||
if (this.setExternalConnection(absDir))
|
||||
{
|
||||
didConnect |= true;
|
||||
}
|
||||
this.setExternalConnection(absDir);
|
||||
|
||||
// Check Corner Connection
|
||||
BlockCoord cornerPos = new BlockCoord(tile());
|
||||
|
@ -330,7 +325,6 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
|||
// We found a wire, merge networks!
|
||||
this.connections[absDir] = tp;
|
||||
this.getNetwork().merge(((PartFlatWire) tp).getNetwork());
|
||||
didConnect |= true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -370,6 +364,10 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
|||
if (this.maskOpen(absSide))
|
||||
{
|
||||
BlockCoord pos = new BlockCoord(tile()).offset(absSide);
|
||||
|
||||
/**
|
||||
* Look for an external wire connection.
|
||||
*/
|
||||
TileMultipart t = Utility.getMultipartTile(world(), pos);
|
||||
|
||||
if (t != null)
|
||||
|
@ -385,10 +383,14 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Look for an external energy handler.
|
||||
*/
|
||||
TileEntity tileEntity = world().getBlockTileEntity(pos.x, pos.y, pos.z);
|
||||
|
||||
if (this.canConnectTo(tileEntity))
|
||||
{
|
||||
System.out.println("FOUND TE");
|
||||
this.connections[absSide] = tileEntity;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ public class TraitConductor extends TileMultipart implements IConductor
|
|||
}
|
||||
|
||||
@Override
|
||||
public long getEnergyLoss()
|
||||
public float getResistance()
|
||||
{
|
||||
long energyLoss = 0;
|
||||
|
||||
|
@ -138,7 +138,7 @@ public class TraitConductor extends TileMultipart implements IConductor
|
|||
{
|
||||
for (IConductor conductor : this.interfaces)
|
||||
{
|
||||
energyLoss += conductor.getEnergyLoss();
|
||||
energyLoss += conductor.getResistance();
|
||||
}
|
||||
|
||||
energyLoss /= this.interfaces.size();
|
||||
|
@ -148,7 +148,7 @@ public class TraitConductor extends TileMultipart implements IConductor
|
|||
}
|
||||
|
||||
@Override
|
||||
public long getEnergyCapacitance()
|
||||
public long getTransferCapacity()
|
||||
{
|
||||
long capacitance = 0;
|
||||
|
||||
|
@ -156,7 +156,7 @@ public class TraitConductor extends TileMultipart implements IConductor
|
|||
{
|
||||
for (IConductor conductor : this.interfaces)
|
||||
{
|
||||
capacitance += conductor.getEnergyCapacitance();
|
||||
capacitance += conductor.getTransferCapacity();
|
||||
}
|
||||
|
||||
capacitance /= this.interfaces.size();
|
||||
|
|
Loading…
Reference in a new issue