summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFoghrye4 <foghrye4@gmail.com>2017-05-31 21:23:10 +0300
committerFoghrye4 <foghrye4@gmail.com>2017-05-31 21:23:10 +0300
commit50d62a1298f05d6d440a5bc261a0fdf9ffece893 (patch)
treea23ad25c213978306a5c9f5e747566b01802078b
parentec543445cec03fb1d638fd8aab87daebb3b1c534 (diff)
energy net fix attempt
-rw-r--r--ihl/IHLModInfo.java2
-rw-r--r--ihl/flexible_cable/FlexibleCableHolderBaseTileEntity.java26
-rw-r--r--ihl/flexible_cable/IHLCable.java111
-rw-r--r--ihl/flexible_cable/IHLENet.java16
-rw-r--r--ihl/flexible_cable/IHLGrid.java44
-rw-r--r--ihl/flexible_cable/PowerCableNodeEntity.java16
-rw-r--r--ihl/flexible_cable/SubAnchorEnergyNetNode.java18
-rw-r--r--ihl/flexible_cable/SubRTUEnergyNetNode.java18
-rw-r--r--ihl/interfaces/IEnergyNetNode.java5
-rw-r--r--ihl/nei_integration/ChemicalReactorRecipeHandler.java3
-rw-r--r--ihl/processing/chemistry/ChemicalReactorTileEntity.java15
-rw-r--r--ihl/processing/chemistry/FractionatorBottomTileEntity.java4
-rw-r--r--ihl/recipes/UniversalRecipeInput.java36
-rw-r--r--ihl/utils/IHLUtils.java35
-rw-r--r--ihl/worldgen/ores/IHLFluid.java9
15 files changed, 246 insertions, 112 deletions
diff --git a/ihl/IHLModInfo.java b/ihl/IHLModInfo.java
index 511d772..1f2977f 100644
--- a/ihl/IHLModInfo.java
+++ b/ihl/IHLModInfo.java
@@ -3,5 +3,5 @@ package ihl;
public class IHLModInfo {
public static final String MODID = "ihl";
public static final String MODNAME = "IHL Tools & Machines for IC2V2";
- public static final String MODVERSION = "0.637";
+ public static final String MODVERSION = "0.643";
}
diff --git a/ihl/flexible_cable/FlexibleCableHolderBaseTileEntity.java b/ihl/flexible_cable/FlexibleCableHolderBaseTileEntity.java
index f922e9b..2923ed2 100644
--- a/ihl/flexible_cable/FlexibleCableHolderBaseTileEntity.java
+++ b/ihl/flexible_cable/FlexibleCableHolderBaseTileEntity.java
@@ -21,13 +21,13 @@ public abstract class FlexibleCableHolderBaseTileEntity extends TileEntityInvent
protected double connectionY;
protected double connectionZ;
protected int gridID=-1;
- protected final Set<NBTTagCompound> cableList;
+ protected final Set<IHLCable> cableList;
public boolean checkCables=true;
public FlexibleCableHolderBaseTileEntity()
{
super();
- cableList=new HashSet<NBTTagCompound>();
+ cableList=new HashSet<IHLCable>();
}
@Override
@@ -68,11 +68,11 @@ public abstract class FlexibleCableHolderBaseTileEntity extends TileEntityInvent
}
protected boolean cableListContains(int chainUniqueID) {
- Iterator<NBTTagCompound> cli = this.getCableList().iterator();
+ Iterator<IHLCable> cli = this.getCableList().iterator();
while(cli.hasNext())
{
- NBTTagCompound c = cli.next();
- if(c.getInteger("chainUID")==chainUniqueID)
+ IHLCable c = cli.next();
+ if(c.chainUID==chainUniqueID)
{
return true;
}
@@ -91,9 +91,9 @@ public abstract class FlexibleCableHolderBaseTileEntity extends TileEntityInvent
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
NBTTagList cableNBTList = new NBTTagList();
- for(NBTTagCompound cable:this.cableList)
+ for(IHLCable cable:this.cableList)
{
- cableNBTList.appendTag(cable);
+ cableNBTList.appendTag(cable.toNBT());
}
nbt.setTag("cableList", cableNBTList);
nbt.setDouble("connectionX", this.connectionX);
@@ -109,7 +109,7 @@ public abstract class FlexibleCableHolderBaseTileEntity extends TileEntityInvent
NBTTagList cableNBTList=nbt.getTagList("cableList", 10);
for(int i=0;i<cableNBTList.tagCount();i++)
{
- this.cableList.add(cableNBTList.getCompoundTagAt(i));
+ this.cableList.add(IHLCable.fromNBT(cableNBTList.getCompoundTagAt(i)));
}
this.setConnectionX(nbt.getDouble("connectionX"));
this.setConnectionY(nbt.getDouble("connectionY"));
@@ -145,11 +145,11 @@ public abstract class FlexibleCableHolderBaseTileEntity extends TileEntityInvent
@Override
public boolean addCable(NBTTagCompound cable)
{
- return this.cableList.add(cable);
+ return this.cableList.add(IHLCable.fromNBT(cable));
}
@Override
- public Set<NBTTagCompound> getCableList() {
+ public Set<IHLCable> getCableList() {
return cableList;
}
@@ -186,7 +186,7 @@ public abstract class FlexibleCableHolderBaseTileEntity extends TileEntityInvent
}
@Override
- public void remove(NBTTagCompound cable)
+ public void remove(IHLCable cable)
{
if(this.cableList.remove(cable))
{
@@ -202,9 +202,9 @@ public abstract class FlexibleCableHolderBaseTileEntity extends TileEntityInvent
{
return false;
}
- for(NBTTagCompound cable:this.cableList)
+ for(IHLCable cable:this.cableList)
{
- if(cable.getInteger("chainUID")==chainUniqueID)
+ if(cable.chainUID==chainUniqueID)
{
return false;
}
diff --git a/ihl/flexible_cable/IHLCable.java b/ihl/flexible_cable/IHLCable.java
new file mode 100644
index 0000000..e47621e
--- /dev/null
+++ b/ihl/flexible_cable/IHLCable.java
@@ -0,0 +1,111 @@
+package ihl.flexible_cable;
+
+import ihl.metallurgy.constants.ElectricConductor;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class IHLCable {
+
+ public final int chainUID;
+ public final int fullLength;
+ public final int length;
+ public final String material;
+ public final int transverseSection;
+ public final String insulationMaterial;
+ public final int insulationThickness;
+ public final int maxVoltage;
+ public final int connectorX1;
+ public final int connectorY1;
+ public final int connectorZ1;
+ public final int connectorDimensionId1;
+ public final short connectorFacing1;
+ public final int connectorX;
+ public final int connectorY;
+ public final int connectorZ;
+ public final int connectorDimensionId;
+ public final short connectorFacing;
+
+ public IHLCable(int chainUIDIn, int fullLengthIn, int lengthIn, String materialIn, int transverseSectionIn,
+ String insulationMaterialIn, int insulationThicknessIn, int maxVoltageIn, int connectorX1In,
+ int connectorY1In, int connectorZ1In, int connectorDimensionId1In, short connectorFacing1In,
+ int connectorXIn, int connectorYIn, int connectorZIn, int connectorDimensionIdIn, short connectorFacingIn) {
+ chainUID = chainUIDIn;
+ fullLength = fullLengthIn;
+ length = lengthIn;
+ material = materialIn;
+ transverseSection = transverseSectionIn;
+ insulationMaterial = insulationMaterialIn;
+ insulationThickness = insulationThicknessIn;
+ maxVoltage = maxVoltageIn;
+ connectorX1 = connectorX1In;
+ connectorY1 = connectorY1In;
+ connectorZ1 = connectorZ1In;
+ connectorDimensionId1 = connectorDimensionId1In;
+ connectorFacing1 = connectorFacing1In;
+ connectorX = connectorXIn;
+ connectorY = connectorYIn;
+ connectorZ = connectorZIn;
+ connectorDimensionId = connectorDimensionIdIn;
+ connectorFacing = connectorFacingIn;
+ }
+
+ public static IHLCable fromNBT(NBTTagCompound tag) {
+ return new IHLCable(tag.getInteger("chainUID"),
+ tag.getInteger("fullLength"),
+ tag.getInteger("length"),
+ tag.getString("material"),
+ tag.getInteger("transverseSection"),
+ tag.getString("insulationMaterial"),
+ tag.getInteger("insulationThickness"),
+ tag.getInteger("maxVoltage"),
+ tag.getInteger("connectorX1"),
+ tag.getInteger("connectorY1"),
+ tag.getInteger("connectorZ1"),
+ tag.getInteger("connectorDimensionId1"),
+ tag.getShort("connectorFacing1"),
+ tag.getInteger("connectorX"),
+ tag.getInteger("connectorY"),
+ tag.getInteger("connectorZ"),
+ tag.getInteger("connectorDimensionId"),
+ tag.getShort("connectorFacing"));
+ }
+
+ public NBTTagCompound toNBT() {
+ NBTTagCompound tag = new NBTTagCompound();
+ tag.setInteger("fullLength", fullLength);
+ tag.setInteger("length", length);
+ tag.setString("material", material);
+ tag.setInteger("transverseSection", transverseSection);
+ tag.setString("insulationMaterial", insulationMaterial);
+ tag.setInteger("insulationThickness", insulationThickness);
+ tag.setInteger("maxVoltage", maxVoltage);
+ tag.setInteger("connectorX1",connectorX1);
+ tag.setInteger("connectorY1",connectorY1);
+ tag.setInteger("connectorZ1",connectorZ1);
+ tag.setInteger("connectorDimensionId1",connectorDimensionId1);
+ tag.setShort("connectorFacing1",connectorFacing1);
+ tag.setInteger("connectorX",connectorX);
+ tag.setInteger("connectorY",connectorY);
+ tag.setInteger("connectorZ",connectorZ);
+ tag.setInteger("connectorDimensionId",connectorDimensionId);
+ tag.setShort("connectorFacing",connectorFacing);
+ return tag;
+ }
+
+ @Override
+ public int hashCode() {
+ return chainUID;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (!(o instanceof IHLCable))
+ return false;
+ IHLCable otherCable = (IHLCable) o;
+ return otherCable.chainUID == this.chainUID;
+ }
+
+ public long getResistance(){
+ return ElectricConductor.getResistivity(material) * 100L / transverseSection;
+ }
+
+}
diff --git a/ihl/flexible_cable/IHLENet.java b/ihl/flexible_cable/IHLENet.java
index f188937..cf0670d 100644
--- a/ihl/flexible_cable/IHLENet.java
+++ b/ihl/flexible_cable/IHLENet.java
@@ -113,17 +113,17 @@ public class IHLENet {
}
}
- public void removeCableAndSplitGrids(int gridID, NBTTagCompound cable)
+ public void removeCableAndSplitGrids(int gridID, IHLCable cable)
{
this.grids.get(gridID).removeCableAndSplitGrids(cable);
}
- public boolean hasSame(Set<NBTTagCompound> set, Set<NBTTagCompound> set2)
+ public boolean hasSame(Set<IHLCable> set, Set<IHLCable> set2)
{
- Iterator<NBTTagCompound> i1 = set.iterator();
+ Iterator<IHLCable> i1 = set.iterator();
while(i1.hasNext())
{
- NBTTagCompound num1=i1.next();
+ IHLCable num1=i1.next();
if(set2.contains(num1))
{
return true;
@@ -132,9 +132,9 @@ public class IHLENet {
return false;
}
- public void setOnFire(NBTTagCompound cable)
+ public void setOnFire(IHLCable cable)
{
- Set<NodeEntity> cs = IHLMod.proxy.nodeEntityRegistry.get(cable.getInteger("chainUID"));
+ Set<NodeEntity> cs = IHLMod.proxy.nodeEntityRegistry.get(cable.chainUID);
if(cs!=null)
{
for(NodeEntity ne:cs)
@@ -144,9 +144,9 @@ public class IHLENet {
}
}
- public void removeCableEntities(NBTTagCompound cable)
+ public void removeCableEntities(IHLCable cable)
{
- int uid = cable.getInteger("chainUID");
+ int uid = cable.chainUID;
Set<NodeEntity> cs = IHLMod.proxy.nodeEntityRegistry.get(uid);
if(cs!=null)
{
diff --git a/ihl/flexible_cable/IHLGrid.java b/ihl/flexible_cable/IHLGrid.java
index 52c50b0..d223e10 100644
--- a/ihl/flexible_cable/IHLGrid.java
+++ b/ihl/flexible_cable/IHLGrid.java
@@ -29,7 +29,7 @@ public class IHLGrid
private int tickCounterFireStart=0;
public final List<IEnergyNetNode> calculatedSinks = new ArrayList<IEnergyNetNode>();
public final List<IEnergyNetNode> calculatedSources = new ArrayList<IEnergyNetNode>();
- public final Set<NBTTagCompound> cablesOnFire = new HashSet<NBTTagCompound> ();
+ public final Set<IHLCable> cablesOnFire = new HashSet<IHLCable> ();
private final Map<IEnergyNetNode, Double> energyLossSinkMap = new HashMap<IEnergyNetNode, Double>();
private final Map<IEnergyNetNode, Double> voltageSinkMap = new HashMap<IEnergyNetNode, Double>();
private double averageEUTransfered;
@@ -95,7 +95,7 @@ public class IHLGrid
d=tickCounter-tickCounterFireStart;
if(d>=200 && !this.cablesOnFire.isEmpty())
{
- for(NBTTagCompound cable:this.cablesOnFire)
+ for(IHLCable cable:this.cablesOnFire)
{
this.removeCableAndSplitGrids(cable);
}
@@ -104,7 +104,7 @@ public class IHLGrid
}
- public void removeCableAndSplitGrids(NBTTagCompound cable)
+ public void removeCableAndSplitGrids(IHLCable cable)
{
IHLUtils.removeChain(cable,null);
Iterator<IEnergyNetNode> atei = this.telist.iterator();
@@ -149,7 +149,9 @@ public class IHLGrid
this.averageEUTransfered>this.lastAverageEUTransfered ||
this.voltage!=this.lastVoltage))
{
- Map<IEnergyNetNode, NBTTagCompound> map = new HashMap<IEnergyNetNode, NBTTagCompound>();
+ IEnergyNetNode[] gridTEList = new IEnergyNetNode[this.telist.size()];
+ gridTEList = this.telist.toArray(gridTEList);
+ Map<IEnergyNetNode, IHLCable> map = new HashMap<IEnergyNetNode, IHLCable>();
Set<IEnergyNetNode> templist = new HashSet<IEnergyNetNode>();
Set<IEnergyNetNode> processlist = new HashSet<IEnergyNetNode>();
Set<IEnergyNetNode> templist2 = new HashSet<IEnergyNetNode>();
@@ -185,7 +187,7 @@ public class IHLGrid
IEnergyNetNode ate2 = it2.next();
if(ate1!=ate2)
{
- NBTTagCompound cable = this.getSame(ate1.getCableList(), ate2.getCableList());
+ IHLCable cable = this.getSame(ate1.getCableList(), ate2.getCableList());
if(cable!=null)
{
map.put(ate2, cable);
@@ -214,12 +216,16 @@ public class IHLGrid
while(cursor!=sink)
{
//System.out.println("cycle 4");
- NBTTagCompound cable = map.get(cursor);
- voltageLossPerMeter=IHLUtils.getResistance(cable)/1000D*euTransfered/voltage1;
+ IHLCable cable = map.get(cursor);
+ if(cable==null) {
+ IHLMod.log.error("One of a cables is null during grid update. Skipping update in this tick.");
+ return;
+ }
+ voltageLossPerMeter=cable.getResistance()/1000D*euTransfered/voltage1;
powerLossPerMeter=voltageLossPerMeter*euTransfered/voltage1;
- euTransfered-=powerLossPerMeter*cable.getInteger("length");
- voltage1-=voltageLossPerMeter*cable.getInteger("length");
- powerLossPerSquaredEU+=IHLUtils.getResistance(cable)/1000d*cable.getInteger("length")/voltage1/voltage1;
+ euTransfered-=powerLossPerMeter*cable.length;
+ voltage1-=voltageLossPerMeter*cable.length;
+ powerLossPerSquaredEU+=cable.getResistance()/1000d*cable.length/voltage1/voltage1;
//System.out.println("voltageLossPerMeter=" + voltageLossPerMeter);
//System.out.println("powerLossPerMeter=" + powerLossPerMeter);
//System.out.println("euTransfered=" + euTransfered);
@@ -231,7 +237,7 @@ public class IHLGrid
tickCounterFireStart=lastTickCounter;
this.cablesOnFire.add(cable);
}
- cursor=this.getHasCable(cable, cursor);
+ cursor=this.getHasCable(cable, cursor, gridTEList);
}
this.energyLossSinkMap.put(sink, powerLossPerSquaredEU);
this.voltageSinkMap.put(sink, voltage1);
@@ -243,12 +249,12 @@ public class IHLGrid
}
}
- private NBTTagCompound getSame(Set<NBTTagCompound> set, Set<NBTTagCompound> set2)
+ private IHLCable getSame(Set<IHLCable> set, Set<IHLCable> set2)
{
- Iterator<NBTTagCompound> i1 = set.iterator();
+ Iterator<IHLCable> i1 = set.iterator();
while(i1.hasNext())
{
- NBTTagCompound cable=i1.next();
+ IHLCable cable=i1.next();
if(set2.contains(cable))
{
return cable;
@@ -269,12 +275,10 @@ public class IHLGrid
}
}
- private IEnergyNetNode getHasCable(NBTTagCompound cable, IEnergyNetNode exclude)
+ private IEnergyNetNode getHasCable(IHLCable cable, IEnergyNetNode exclude, IEnergyNetNode[] gridTEList)
{
- Iterator<IEnergyNetNode> it1 = this.telist.iterator();
- while(it1.hasNext())
+ for(IEnergyNetNode ate1:gridTEList)
{
- IEnergyNetNode ate1 = it1.next();
if(ate1!=exclude && ate1.getCableList().contains(cable))
{
return ate1;
@@ -289,9 +293,9 @@ public class IHLGrid
this.isGridValid=true;
if(!e.getCableList().isEmpty())
{
- for(NBTTagCompound cable:e.getCableList())
+ for(IHLCable cable:e.getCableList())
{
- IHLMod.enet.cablesToGrids.put(cable.getInteger("chainUID"), this);
+ IHLMod.enet.cablesToGrids.put(cable.chainUID, this);
}
}
}
diff --git a/ihl/flexible_cable/PowerCableNodeEntity.java b/ihl/flexible_cable/PowerCableNodeEntity.java
index ed5a7ea..7396967 100644
--- a/ihl/flexible_cable/PowerCableNodeEntity.java
+++ b/ihl/flexible_cable/PowerCableNodeEntity.java
@@ -21,8 +21,8 @@ import net.minecraft.world.World;
public class PowerCableNodeEntity extends NodeEntity implements IEnergyNetNode{
- private Set<NBTTagCompound> cableList;
- private NBTTagCompound cable;
+ private Set<IHLCable> cableList;
+ private IHLCable cable;
private double soundRange=10d;
private final static float groundConductivity=0.005f;
private int lastCheckTimer=0;
@@ -138,7 +138,7 @@ public class PowerCableNodeEntity extends NodeEntity implements IEnergyNetNode{
super.writeEntityToNBT(nbt);
if(this.cable!=null)
{
- nbt.setTag("cable",this.cable);
+ nbt.setTag("cable",this.cable.toNBT());
}
}
@@ -162,7 +162,7 @@ public class PowerCableNodeEntity extends NodeEntity implements IEnergyNetNode{
{
if(this.cable!=null)
{
- return this.cable.getInteger("maxVoltage");
+ return this.cable.maxVoltage;
}
else
{
@@ -173,15 +173,15 @@ public class PowerCableNodeEntity extends NodeEntity implements IEnergyNetNode{
@Override
public boolean addCable(NBTTagCompound cable1)
{
- this.cable=cable1;
+ this.cable=IHLCable.fromNBT(cable1);
return true;
}
@Override
- public Set<NBTTagCompound> getCableList() {
+ public Set<IHLCable> getCableList() {
if(cableList==null)
{
- cableList=new HashSet<NBTTagCompound>(1);
+ cableList=new HashSet<IHLCable>(1);
if(this.cable!=null)
{
cableList.add(this.cable);
@@ -212,7 +212,7 @@ public class PowerCableNodeEntity extends NodeEntity implements IEnergyNetNode{
}
@Override
- public void remove(NBTTagCompound cable)
+ public void remove(IHLCable cable)
{
this.cableList.remove(cable);
}
diff --git a/ihl/flexible_cable/SubAnchorEnergyNetNode.java b/ihl/flexible_cable/SubAnchorEnergyNetNode.java
index 3fb9f76..5fd4d91 100644
--- a/ihl/flexible_cable/SubAnchorEnergyNetNode.java
+++ b/ihl/flexible_cable/SubAnchorEnergyNetNode.java
@@ -23,7 +23,7 @@ public class SubAnchorEnergyNetNode implements IEnergyNetNode{
private AnchorTileEntity base;
private short facing;
private int gridID=-1;
- private Set<NBTTagCompound> cableList = new HashSet<NBTTagCompound>();
+ private Set<IHLCable> cableList = new HashSet<IHLCable>();
public SubAnchorEnergyNetNode(AnchorTileEntity base1, short facing1)
{
@@ -129,11 +129,11 @@ public class SubAnchorEnergyNetNode implements IEnergyNetNode{
public boolean addCable(NBTTagCompound cable)
{
base.hasCableOnSide[this.facing]=true;
- return this.cableList.add(cable);
+ return this.cableList.add(IHLCable.fromNBT(cable));
}
@Override
- public Set<NBTTagCompound> getCableList() {
+ public Set<IHLCable> getCableList() {
return cableList;
}
@@ -156,9 +156,9 @@ public class SubAnchorEnergyNetNode implements IEnergyNetNode{
{
NBTTagCompound nbt = new NBTTagCompound();
NBTTagList cableNBTList = new NBTTagList();
- for(NBTTagCompound cable:this.cableList)
+ for(IHLCable cable:this.cableList)
{
- cableNBTList.appendTag(cable);
+ cableNBTList.appendTag(cable.toNBT());
}
nbt.setTag("cableList", cableNBTList);
nbt.setInteger("gridID", this.gridID);
@@ -169,7 +169,7 @@ public class SubAnchorEnergyNetNode implements IEnergyNetNode{
NBTTagList cableNBTList=nbt.getTagList("cableList", 10);
for(int i=0;i<cableNBTList.tagCount();i++)
{
- this.cableList.add(cableNBTList.getCompoundTagAt(i));
+ this.cableList.add(IHLCable.fromNBT(cableNBTList.getCompoundTagAt(i)));
}
this.gridID=nbt.getInteger("gridID");
if(this.gridID!=-1)
@@ -222,7 +222,7 @@ public class SubAnchorEnergyNetNode implements IEnergyNetNode{
}
@Override
- public void remove(NBTTagCompound cable)
+ public void remove(IHLCable cable)
{
if(this.cableList.remove(cable))
{
@@ -250,9 +250,9 @@ public class SubAnchorEnergyNetNode implements IEnergyNetNode{
@Override
public boolean isCableRemoved(int chainUniqueID) {
- for(NBTTagCompound cable:this.cableList)
+ for(IHLCable cable:this.cableList)
{
- if(cable.getInteger("chainUID")==chainUniqueID)
+ if(cable.chainUID==chainUniqueID)
{
return false;
}
diff --git a/ihl/flexible_cable/SubRTUEnergyNetNode.java b/ihl/flexible_cable/SubRTUEnergyNetNode.java
index ccb46b8..df5e9e4 100644
--- a/ihl/flexible_cable/SubRTUEnergyNetNode.java
+++ b/ihl/flexible_cable/SubRTUEnergyNetNode.java
@@ -19,7 +19,7 @@ public class SubRTUEnergyNetNode implements IEnergyNetNode{
private RectifierTransformerUnitTileEntity base;
private short side;
private int gridID=-1;
- private Set<NBTTagCompound> cableList = new HashSet<NBTTagCompound>();
+ private Set<IHLCable> cableList = new HashSet<IHLCable>();
public SubRTUEnergyNetNode(RectifierTransformerUnitTileEntity base1, short facing1)
{
@@ -153,11 +153,11 @@ public class SubRTUEnergyNetNode implements IEnergyNetNode{
@Override
public boolean addCable(NBTTagCompound cable)
{
- return this.cableList.add(cable);
+ return this.cableList.add(IHLCable.fromNBT(cable));
}
@Override
- public Set<NBTTagCompound> getCableList() {
+ public Set<IHLCable> getCableList() {
return cableList;
}
@@ -180,9 +180,9 @@ public class SubRTUEnergyNetNode implements IEnergyNetNode{
{
NBTTagCompound nbt = new NBTTagCompound();
NBTTagList cableNBTList = new NBTTagList();
- for(NBTTagCompound cable:this.cableList)
+ for(IHLCable cable:this.cableList)
{
- cableNBTList.appendTag(cable);
+ cableNBTList.appendTag(cable.toNBT());
}
nbt.setTag("cableList", cableNBTList);
nbt.setInteger("gridID", this.gridID);
@@ -193,7 +193,7 @@ public class SubRTUEnergyNetNode implements IEnergyNetNode{
NBTTagList cableNBTList=nbt.getTagList("cableList", 10);
for(int i=0;i<cableNBTList.tagCount();i++)
{
- this.cableList.add(cableNBTList.getCompoundTagAt(i));
+ this.cableList.add(IHLCable.fromNBT(cableNBTList.getCompoundTagAt(i)));
}
this.gridID=nbt.getInteger("gridID");
}
@@ -237,7 +237,7 @@ public class SubRTUEnergyNetNode implements IEnergyNetNode{
}
@Override
- public void remove(NBTTagCompound cable)
+ public void remove(IHLCable cable)
{
if(this.cableList.remove(cable))
{
@@ -260,9 +260,9 @@ public class SubRTUEnergyNetNode implements IEnergyNetNode{
@Override
public boolean isCableRemoved(int chainUniqueID) {
- for(NBTTagCompound cable:this.cableList)
+ for(IHLCable cable:this.cableList)
{
- if(cable.getInteger("chainUID")==chainUniqueID)
+ if(cable.chainUID==chainUniqueID)
{
return false;
}
diff --git a/ihl/interfaces/IEnergyNetNode.java b/ihl/interfaces/IEnergyNetNode.java
index 3d04160..b18b166 100644
--- a/ihl/interfaces/IEnergyNetNode.java
+++ b/ihl/interfaces/IEnergyNetNode.java
@@ -2,6 +2,7 @@ package ihl.interfaces;
import java.util.Set;
+import ihl.flexible_cable.IHLCable;
import ihl.flexible_cable.IHLGrid;
import net.minecraft.nbt.NBTTagCompound;
@@ -11,9 +12,9 @@ public interface IEnergyNetNode extends ICableHolder{
void setGrid(int newGridID);
double getMaxAllowableVoltage();
boolean addCable(NBTTagCompound cable);
- Set<NBTTagCompound> getCableList();
+ Set<IHLCable> getCableList();
void removeAttachedChains();
- void remove(NBTTagCompound cable);
+ void remove(IHLCable cable);
double getEnergyAmountThisNodeWant();
void injectEnergyInThisNode(double amount, double voltage);
}
diff --git a/ihl/nei_integration/ChemicalReactorRecipeHandler.java b/ihl/nei_integration/ChemicalReactorRecipeHandler.java
index f627314..53eeb8d 100644
--- a/ihl/nei_integration/ChemicalReactorRecipeHandler.java
+++ b/ihl/nei_integration/ChemicalReactorRecipeHandler.java
@@ -37,7 +37,7 @@ public class ChemicalReactorRecipeHandler extends MachineRecipeHandler
@Override
protected int[] getFluidInputPosX()
{
- return new int[]{42-5,60-5};
+ return new int[]{60-5,42-5,24-5};
}
@Override
@@ -112,6 +112,7 @@ public class ChemicalReactorRecipeHandler extends MachineRecipeHandler
public void drawBackground(int i)
{
super.drawBackground(i);
+ GuiDraw.drawTexturedModalRect(23-5, 14-11, 59, 14, 18, 18);
GuiDraw.drawTexturedModalRect(41-5, 14-11, 59, 14, 18, 18);
GuiDraw.drawTexturedModalRect(41-5, 50-11, 59, 50, 18, 18);
}
diff --git a/ihl/processing/chemistry/ChemicalReactorTileEntity.java b/ihl/processing/chemistry/ChemicalReactorTileEntity.java
index a124265..7de2ccf 100644
--- a/ihl/processing/chemistry/ChemicalReactorTileEntity.java
+++ b/ihl/processing/chemistry/ChemicalReactorTileEntity.java
@@ -196,20 +196,7 @@ public class ChemicalReactorTileEntity extends BasicElectricMotorTileEntity impl
@Override
public List[] getInput()
{
- for(int i=0;i<fluidTank.getNumberOfFluids();i++)
- {
- for(int i1=0;i1<fluidTank.getNumberOfFluids();i1++)
- {
- if(i!=i1)
- {
- if(ChemicalReactorTileEntity.recipeManager.getOutputFor(Arrays.asList(new FluidStack[]{fluidTank.getFluid(i),fluidTank.getFluid(i1)}), this.input.getItemStackList())!=null)
- {
- return new List[] {Arrays.asList(new FluidStack[]{fluidTank.getFluid(i),fluidTank.getFluid(i1)}), this.input.getItemStackList()};
- }
- }
- }
- }
- return new List[] {Arrays.asList(new FluidStack[]{fluidTank.getFluid()}), this.input.getItemStackList()};
+ return new List[] {fluidTank.getFluidList(), this.input.getItemStackList()};
}
@Override
diff --git a/ihl/processing/chemistry/FractionatorBottomTileEntity.java b/ihl/processing/chemistry/FractionatorBottomTileEntity.java
index 288924e..eeabf61 100644
--- a/ihl/processing/chemistry/FractionatorBottomTileEntity.java
+++ b/ihl/processing/chemistry/FractionatorBottomTileEntity.java
@@ -114,8 +114,8 @@ public class FractionatorBottomTileEntity extends TileEntityInventory implements
FluidStack fsCurrentInput = this.fluidTank.getFluid();
if(fsCurrentInput!=null && fsCurrentInput.amount>100 && systemHeat>0)
{
- UniversalRecipeOutput rOutput = FractionatorBottomTileEntity.recipeManager.getOutputFor(Arrays.asList(new FluidStack [] {this.fluidTank.getFluid()}),null);
- UniversalRecipeInput rInput = FractionatorBottomTileEntity.recipeManager.getRecipeInput(Arrays.asList(new FluidStack [] {this.fluidTank.getFluid()}),null);
+ UniversalRecipeOutput rOutput = FractionatorBottomTileEntity.recipeManager.getOutputFor(this.fluidTank.getFluidList(),null);
+ UniversalRecipeInput rInput = FractionatorBottomTileEntity.recipeManager.getRecipeInput(this.fluidTank.getFluidList(),null);
if(rOutput!=null)
{
IRecipeInputFluid input = rInput.getFluidInputs().get(0);
diff --git a/ihl/recipes/UniversalRecipeInput.java b/ihl/recipes/UniversalRecipeInput.java
index 2ed546a..7cdb386 100644
--- a/ihl/recipes/UniversalRecipeInput.java
+++ b/ihl/recipes/UniversalRecipeInput.java
@@ -1,14 +1,18 @@
package ihl.recipes;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import ic2.api.recipe.IRecipeInput;
import ic2.api.recipe.RecipeInputItemStack;
import ic2.api.recipe.RecipeInputOreDict;
import ihl.interfaces.IWire;
import ihl.utils.IHLUtils;
+import ihl.worldgen.ores.IHLFluid;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
@@ -30,6 +34,7 @@ public class UniversalRecipeInput {
}
}
}
+ sortFluidsByDensity();
if (iRecipeInputs != null) {
for (Object material : iRecipeInputs) {
if (material == null) {
@@ -51,6 +56,37 @@ public class UniversalRecipeInput {
}
}
}
+
+ public void sortFluidsByDensity()
+ {
+ Map<Integer, IRecipeInputFluid> sortMap = new HashMap<Integer, IRecipeInputFluid>();
+ int[] keysArray = new int[fluidInputs.size()];
+ Iterator<IRecipeInputFluid> fli = fluidInputs.iterator();
+ while(fli.hasNext())
+ {
+ IRecipeInputFluid rinput = fli.next();
+ FluidStack fluid=rinput.getInputs().get(0);
+ if(fluid==null)
+ {
+ return;
+ }
+ int key = Math.round(IHLFluid.getRealDensity(fluid.getFluid())*100F);
+ while(sortMap.containsKey(key))
+ {
+ key++;
+ }
+ sortMap.put(key, rinput);
+ keysArray[fluidInputs.indexOf(rinput)]=key;
+ }
+ Arrays.sort(keysArray);
+ List<IRecipeInputFluid> newFluidList = new ArrayList<IRecipeInputFluid>();
+ for(int i=keysArray.length-1;i>=0;i--)
+ {
+ newFluidList.add(sortMap.get(keysArray[i]));
+ }
+ this.fluidInputs.clear();
+ this.fluidInputs.addAll(newFluidList);
+ }
public boolean matches(List<FluidStack> fluidInputs1, List<ItemStack> itemInputs1) {
return this.matches(fluidInputs1, itemInputs1, false);
diff --git a/ihl/utils/IHLUtils.java b/ihl/utils/IHLUtils.java
index c37e11e..0f23f01 100644
--- a/ihl/utils/IHLUtils.java
+++ b/ihl/utils/IHLUtils.java
@@ -19,6 +19,7 @@ import ic2.core.BasicMachineRecipeManager;
import ic2.core.IC2;
import ic2.core.block.invslot.InvSlotOutput;
import ihl.IHLMod;
+import ihl.flexible_cable.IHLCable;
import ihl.interfaces.IEnergyNetNode;
import ihl.interfaces.IMultiPowerCableHolder;
import ihl.interfaces.IWire;
@@ -762,14 +763,14 @@ public class IHLUtils {
}
public static void removeChains(IEnergyNetNode te, World world) {
- Set<NBTTagCompound> cableList = te.getCableList();
- Iterator<NBTTagCompound> cli = cableList.iterator();
+ Set<IHLCable> cableList = te.getCableList();
+ Iterator<IHLCable> cli = cableList.iterator();
while (cli.hasNext()) {
- NBTTagCompound c = cli.next();
+ IHLCable c = cli.next();
cli.remove();
IHLMod.enet.removeCableEntities(c);
ItemStack is = IHLUtils.getThisModItemStack("copperWire");
- is.stackTagCompound = c;
+ is.stackTagCompound = c.toNBT();
double[] pps = te.getPortPos(null);
EntityItem eitem = new EntityItem(world, pps[0], pps[1], pps[2], is);
world.spawnEntityInWorld(eitem);
@@ -781,12 +782,12 @@ public class IHLUtils {
cableList.clear();
}
- public static void removeChain(NBTTagCompound c, IEnergyNetNode excludeNode) {
- int x = c.getInteger("connectorX1");
- int y = c.getInteger("connectorY1");
- int z = c.getInteger("connectorZ1");
- int t2DimensionId = c.getInteger("connectorDimensionId1");
- short facing2 = c.getShort("connectorFacing1");
+ public static void removeChain(IHLCable cable, IEnergyNetNode excludeNode) {
+ int x = cable.connectorX1;
+ int y = cable.connectorY1;
+ int z = cable.connectorZ1;
+ int t2DimensionId = cable.connectorDimensionId1;
+ short facing2 = cable.connectorFacing1;
TileEntity t2 = MinecraftServer.getServer().worldServerForDimension(t2DimensionId).getTileEntity(x, y, z);
IEnergyNetNode te2;
if (t2 instanceof IMultiPowerCableHolder) {
@@ -797,13 +798,13 @@ public class IHLUtils {
return;
}
if (excludeNode != te2) {
- te2.remove(c);
+ te2.remove(cable);
}
- x = c.getInteger("connectorX");
- y = c.getInteger("connectorY");
- z = c.getInteger("connectorZ");
- t2DimensionId = c.getInteger("connectorDimensionId");
- facing2 = c.getShort("connectorFacing");
+ x = cable.connectorX;
+ y = cable.connectorY;
+ z = cable.connectorZ;
+ t2DimensionId = cable.connectorDimensionId;
+ facing2 = cable.connectorFacing;
t2 = MinecraftServer.getServer().worldServerForDimension(t2DimensionId).getTileEntity(x, y, z);
if (t2 instanceof IMultiPowerCableHolder) {
te2 = ((IMultiPowerCableHolder) t2).getEnergyNetNode(facing2);
@@ -813,7 +814,7 @@ public class IHLUtils {
return;
}
if (excludeNode != te2) {
- te2.remove(c);
+ te2.remove(cable);
}
}
diff --git a/ihl/worldgen/ores/IHLFluid.java b/ihl/worldgen/ores/IHLFluid.java
index d35dc73..5e2e08b 100644
--- a/ihl/worldgen/ores/IHLFluid.java
+++ b/ihl/worldgen/ores/IHLFluid.java
@@ -120,14 +120,7 @@ public class IHLFluid extends Fluid {
IHLFluidType type = localFluidRegistry.get(fluid.getName());
return type.boilingPoint;
} else {
- if (fluid.getName() == "steam" || fluid.getName() == "ic2steam"
- || fluid.getName() == "ic2superheatedsteam") {
- return 373;
- } else if (fluid.isGaseous()) {
- return fluid.getTemperature();
- } else {
- return fluid.getTemperature() + 100;
- }
+ return 373;
}
}