From 50d62a1298f05d6d440a5bc261a0fdf9ffece893 Mon Sep 17 00:00:00 2001 From: Foghrye4 Date: Wed, 31 May 2017 21:23:10 +0300 Subject: energy net fix attempt --- ihl/IHLModInfo.java | 2 +- .../FlexibleCableHolderBaseTileEntity.java | 26 ++--- ihl/flexible_cable/IHLCable.java | 111 +++++++++++++++++++++ ihl/flexible_cable/IHLENet.java | 16 +-- ihl/flexible_cable/IHLGrid.java | 44 ++++---- ihl/flexible_cable/PowerCableNodeEntity.java | 16 +-- ihl/flexible_cable/SubAnchorEnergyNetNode.java | 18 ++-- ihl/flexible_cable/SubRTUEnergyNetNode.java | 18 ++-- ihl/interfaces/IEnergyNetNode.java | 5 +- .../ChemicalReactorRecipeHandler.java | 3 +- .../chemistry/ChemicalReactorTileEntity.java | 15 +-- .../chemistry/FractionatorBottomTileEntity.java | 4 +- ihl/recipes/UniversalRecipeInput.java | 36 +++++++ ihl/utils/IHLUtils.java | 35 +++---- ihl/worldgen/ores/IHLFluid.java | 9 +- 15 files changed, 246 insertions(+), 112 deletions(-) create mode 100644 ihl/flexible_cable/IHLCable.java 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 cableList; + protected final Set cableList; public boolean checkCables=true; public FlexibleCableHolderBaseTileEntity() { super(); - cableList=new HashSet(); + cableList=new HashSet(); } @Override @@ -68,11 +68,11 @@ public abstract class FlexibleCableHolderBaseTileEntity extends TileEntityInvent } protected boolean cableListContains(int chainUniqueID) { - Iterator cli = this.getCableList().iterator(); + Iterator 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 getCableList() { + public Set 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 set, Set set2) + public boolean hasSame(Set set, Set set2) { - Iterator i1 = set.iterator(); + Iterator 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 cs = IHLMod.proxy.nodeEntityRegistry.get(cable.getInteger("chainUID")); + Set 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 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 calculatedSinks = new ArrayList(); public final List calculatedSources = new ArrayList(); - public final Set cablesOnFire = new HashSet (); + public final Set cablesOnFire = new HashSet (); private final Map energyLossSinkMap = new HashMap(); private final Map voltageSinkMap = new HashMap(); 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 atei = this.telist.iterator(); @@ -149,7 +149,9 @@ public class IHLGrid this.averageEUTransfered>this.lastAverageEUTransfered || this.voltage!=this.lastVoltage)) { - Map map = new HashMap(); + IEnergyNetNode[] gridTEList = new IEnergyNetNode[this.telist.size()]; + gridTEList = this.telist.toArray(gridTEList); + Map map = new HashMap(); Set templist = new HashSet(); Set processlist = new HashSet(); Set templist2 = new HashSet(); @@ -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 set, Set set2) + private IHLCable getSame(Set set, Set set2) { - Iterator i1 = set.iterator(); + Iterator 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 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 cableList; - private NBTTagCompound cable; + private Set 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 getCableList() { + public Set getCableList() { if(cableList==null) { - cableList=new HashSet(1); + cableList=new HashSet(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 cableList = new HashSet(); + private Set cableList = new HashSet(); 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 getCableList() { + public Set 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 cableList = new HashSet(); + private Set cableList = new HashSet(); 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 getCableList() { + public Set 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 getCableList(); + Set 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;i100 && 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 sortMap = new HashMap(); + int[] keysArray = new int[fluidInputs.size()]; + Iterator 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 newFluidList = new ArrayList(); + 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 fluidInputs1, List 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 cableList = te.getCableList(); - Iterator cli = cableList.iterator(); + Set cableList = te.getCableList(); + Iterator 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; } } -- cgit v1.2.3