diff options
Diffstat (limited to 'src/main/java/gregtech/api')
24 files changed, 229 insertions, 114 deletions
diff --git a/src/main/java/gregtech/api/enums/ItemList.java b/src/main/java/gregtech/api/enums/ItemList.java index 5d6de01493..64bda0f170 100644 --- a/src/main/java/gregtech/api/enums/ItemList.java +++ b/src/main/java/gregtech/api/enums/ItemList.java @@ -1571,6 +1571,8 @@ public enum ItemList implements IItemContainer { FluidRegulator_ZPM, FluidRegulator_UV, FluidFilter, + ItemFilter_Export, + ItemFilter_Import, CuringOven, Machine_Multi_Assemblyline, Machine_Multi_DieselEngine, diff --git a/src/main/java/gregtech/api/enums/Materials.java b/src/main/java/gregtech/api/enums/Materials.java index 1bb38f7621..905e08a434 100644 --- a/src/main/java/gregtech/api/enums/Materials.java +++ b/src/main/java/gregtech/api/enums/Materials.java @@ -508,15 +508,15 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { public static Materials EnrichedNaquadria = new MaterialBuilder(601, TextureSet.SET_FLUID , "Enriched Naquadria").setName("EnrichedNaquadria").addCell().addFluid().setRGB(52, 52, 52).setColor(Dyes.dyeBlack).constructMaterial(); public static Materials ReinforceGlass = new MaterialBuilder(602, TextureSet.SET_FLUID , "Molten Reinforced Glass").setName("ReinforcedGlass").addCell().addFluid().setRGB(192, 245, 254).setColor(Dyes.dyeWhite).setLiquidTemperature(2000).constructMaterial(); - public static Materials BioMediumRaw = new MaterialBuilder(603, TextureSet.SET_FLUID , "Raw Bio Medium").setName("BioMediumRaw").addCell().addFluid().setRGB(97, 147, 46).setColor(Dyes.dyeLime).constructMaterial(); - public static Materials BioMediumSterilized = new MaterialBuilder(604, TextureSet.SET_FLUID , "Sterilized Bio Medium").setName("BiohMediumSterilized").addCell().addFluid().setRGB(162, 253, 53).setColor(Dyes.dyeLime).constructMaterial(); + public static Materials BioMediumRaw = new MaterialBuilder(603, TextureSet.SET_FLUID , "Raw Bio Catalyst Medium").setName("BioMediumRaw").addCell().addFluid().setRGB(97, 147, 46).setColor(Dyes.dyeLime).constructMaterial(); + public static Materials BioMediumSterilized = new MaterialBuilder(604, TextureSet.SET_FLUID , "Sterilized Bio Catalyst Medium").setName("BiohMediumSterilized").addCell().addFluid().setRGB(162, 253, 53).setColor(Dyes.dyeLime).constructMaterial(); public static Materials Chlorobenzene = new MaterialBuilder(605, TextureSet.SET_FLUID , "Chlorobenzene").addCell().addFluid().setRGB(0, 50, 65).setColor(Dyes.dyeGray).setMaterialList(new MaterialStack(Carbon, 6), new MaterialStack(Hydrogen, 5), new MaterialStack(Chlorine, 1)).addElectrolyzerRecipe().constructMaterial(); public static Materials DilutedHydrochloricAcid = new MaterialBuilder(606, TextureSet.SET_FLUID , "Diluted Hydrochloric Acid").setName("DilutedHydrochloricAcid_GT5U").addCell().addFluid().setRGB(153, 167, 163).setColor(Dyes.dyeLightGray).setMaterialList(new MaterialStack(Hydrogen, 1), new MaterialStack(Chlorine, 1)).constructMaterial(); public static Materials Pyrochlore = new MaterialBuilder(607, TextureSet.SET_METALLIC , "Pyrochlore").addDustItems().addOreItems().setRGB(43, 17, 0).setColor(Dyes.dyeBlack).setMaterialList(new MaterialStack(Calcium, 2), new MaterialStack(Niobium, 2), new MaterialStack(Oxygen, 7)).addElectrolyzerRecipe().constructMaterial(); - public static Materials GrowthMediumRaw = new MaterialBuilder(608, TextureSet.SET_FLUID , "Raw Growth Medium").setName("GrowthMediumRaw").addCell().addFluid().setRGB(211, 141, 95).setColor(Dyes.dyeOrange).constructMaterial(); - public static Materials GrowthMediumSterilized = new MaterialBuilder(609, TextureSet.SET_FLUID , "Sterilized Growth Medium").setName("GrowthMediumSterilized").addCell().addFluid().setRGB(222, 170, 135).setColor(Dyes.dyeOrange).constructMaterial(); + public static Materials GrowthMediumRaw = new MaterialBuilder(608, TextureSet.SET_FLUID , "Raw Growth Catalyst Medium").setName("GrowthMediumRaw").addCell().addFluid().setRGB(211, 141, 95).setColor(Dyes.dyeOrange).constructMaterial(); + public static Materials GrowthMediumSterilized = new MaterialBuilder(609, TextureSet.SET_FLUID , "Growth Catalyst Medium").setName("GrowthMediumSterilized").addCell().addFluid().setRGB(222, 170, 135).setColor(Dyes.dyeOrange).constructMaterial(); public static Materials FerriteMixture = new MaterialBuilder(612, TextureSet.SET_METALLIC , "Ferrite Mixture").addDustItems().setRGB(180, 180, 180).setColor(Dyes.dyeGray).setMaterialList(new MaterialStack(Nickel, 1), new MaterialStack(Zinc, 1), new MaterialStack(Iron, 4)).constructMaterial(); public static Materials NickelZincFerrite = new MaterialBuilder(613, TextureSet.SET_ROUGH , "Nickel-Zinc Ferrite").addDustItems().addMetalItems().addToolHeadItems().addGearItems().setToolSpeed(3.0f).setDurability(32).setRGB(60, 60, 60).setColor(Dyes.dyeBlack).setBlastFurnaceRequired(true).setBlastFurnaceTemp(1500).setMaterialList(new MaterialStack(Nickel, 1), new MaterialStack(Zinc, 1), new MaterialStack(Iron, 4), new MaterialStack(Oxygen, 8)).constructMaterial(); diff --git a/src/main/java/gregtech/api/graphs/GenerateNodeMap.java b/src/main/java/gregtech/api/graphs/GenerateNodeMap.java index 60a820cdd1..98c8215fc7 100644 --- a/src/main/java/gregtech/api/graphs/GenerateNodeMap.java +++ b/src/main/java/gregtech/api/graphs/GenerateNodeMap.java @@ -13,7 +13,7 @@ import static gregtech.api.util.GT_Utility.getOppositeSide; //generates the node map abstract public class GenerateNodeMap { - //clearign the node map to make sure it is gone on reset + //clearing the node map to make sure it is gone on reset public static void clearNodeMap(Node aNode,int aReturnNodeValue) { if (aNode.mTileEntity instanceof BaseMetaPipeEntity) { BaseMetaPipeEntity tPipe = (BaseMetaPipeEntity) aNode.mTileEntity; @@ -25,21 +25,21 @@ abstract public class GenerateNodeMap { } } for (int i = 0;i<6;i++) { - NodePath tPath = aNode.mNodePats[i]; + NodePath tPath = aNode.mNodePaths[i]; if (tPath != null) { tPath.clearPath(); - aNode.mNodePats[i] = null; + aNode.mNodePaths[i] = null; } - Node tNextNode = aNode.mNeigbourNodes[i]; + Node tNextNode = aNode.mNeighbourNodes[i]; if (tNextNode == null) continue; if (tNextNode.mNodeValue != aReturnNodeValue) clearNodeMap(tNextNode,aNode.mNodeValue); - aNode.mNeigbourNodes[i] = null; + aNode.mNeighbourNodes[i] = null; } } //gets the next node - protected void generateNextNode(BaseMetaPipeEntity aPipe, Node aPipeNode, byte aInvalidSide, int aNextNodeVale, + protected void generateNextNode(BaseMetaPipeEntity aPipe, Node aPipeNode, byte aInvalidSide, int aNextNodeValue, ArrayList<ConsumerNode> tConsumers, HashSet<Node> tNodeMap) { MetaPipeEntity tMetaPipe = (MetaPipeEntity) aPipe.getMetaTileEntity(); for (byte i = 0;i<6;i++) { @@ -51,20 +51,20 @@ abstract public class GenerateNodeMap { ArrayList<MetaPipeEntity> tNewPipes = new ArrayList<MetaPipeEntity>(); Pair nextTileEntity = getNextValidTileEntity(tNextTileEntity,tNewPipes,i,tNodeMap); if (nextTileEntity != null) { - Node tNextNode = generateNode(nextTileEntity.mTileEntity,aPipeNode,aNextNodeVale+1,tNewPipes, + Node tNextNode = generateNode(nextTileEntity.mTileEntity,aPipeNode,aNextNodeValue+1,tNewPipes, nextTileEntity.mSide,tConsumers,tNodeMap); if (tNextNode != null) { - aNextNodeVale = tNextNode.mHigestNodeValue; - aPipeNode.mHigestNodeValue = tNextNode.mHigestNodeValue; - aPipeNode.mNeigbourNodes[i] = tNextNode; - aPipeNode.mNodePats[i] = aPipeNode.mReturnPath; + aNextNodeValue = tNextNode.mHighestNodeValue; + aPipeNode.mHighestNodeValue = tNextNode.mHighestNodeValue; + aPipeNode.mNeighbourNodes[i] = tNextNode; + aPipeNode.mNodePaths[i] = aPipeNode.mReturnPath; } } } } - //on a valid tilentity create a new node - protected Node generateNode(TileEntity aTileEntity, Node aPreviousNode, int aNextNodeVale, ArrayList<MetaPipeEntity> aPipes, + //on a valid tile entity create a new node + protected Node generateNode(TileEntity aTileEntity, Node aPreviousNode, int aNextNodeValue, ArrayList<MetaPipeEntity> aPipes, int aSide, ArrayList<ConsumerNode> aConsumers, HashSet<Node> aNodeMap) { if (aTileEntity.isInvalid()) return null; byte tSideOp = getOppositeSide(aSide); @@ -73,36 +73,36 @@ abstract public class GenerateNodeMap { if (isPipe(aTileEntity)){ BaseMetaPipeEntity tPipe = (BaseMetaPipeEntity) aTileEntity; MetaPipeEntity tMetaPipe = (MetaPipeEntity) tPipe.getMetaTileEntity(); - int tConections = getNumberOfConections(tMetaPipe); + int tConnections = getNumberOfConnections(tMetaPipe); Node tPipeNode; - if (tConections == 1) { - tPipeNode = getEmptyNode(aNextNodeVale,tSideOp,aTileEntity,aConsumers); + if (tConnections == 1) { + tPipeNode = getEmptyNode(aNextNodeValue,tSideOp,aTileEntity,aConsumers); if (tPipeNode == null) return null; } else { - tPipeNode = getPipeNode(aNextNodeVale,tSideOp,aTileEntity,aConsumers); + tPipeNode = getPipeNode(aNextNodeValue,tSideOp,aTileEntity,aConsumers); } tPipe.setNode(tPipeNode); aNodeMap.add(tPipeNode); tPipeNode.mSelfPath = getNewPath(new MetaPipeEntity[]{tMetaPipe}); tThisNode = tPipeNode; if (tInvalidSide>-1) { - tPipeNode.mNeigbourNodes[tInvalidSide] = aPreviousNode; - tPipeNode.mNodePats[tInvalidSide] = getNewPath(aPipes.toArray(new MetaPipeEntity[0])); - aPreviousNode.mReturnPath = tPipeNode.mNodePats[tInvalidSide]; + tPipeNode.mNeighbourNodes[tInvalidSide] = aPreviousNode; + tPipeNode.mNodePaths[tInvalidSide] = getNewPath(aPipes.toArray(new MetaPipeEntity[0])); + aPreviousNode.mReturnPath = tPipeNode.mNodePaths[tInvalidSide]; } - if (tConections > 1) - generateNextNode(tPipe,tPipeNode,tInvalidSide,aNextNodeVale,aConsumers,aNodeMap); - } else if (addConsumer(aTileEntity,tSideOp,aNextNodeVale,aConsumers)) { + if (tConnections > 1) + generateNextNode(tPipe,tPipeNode,tInvalidSide,aNextNodeValue,aConsumers,aNodeMap); + } else if (addConsumer(aTileEntity,tSideOp,aNextNodeValue,aConsumers)) { ConsumerNode tConsumeNode = aConsumers.get(aConsumers.size()-1); - tConsumeNode.mNeigbourNodes[tSideOp] = aPreviousNode; - tConsumeNode.mNodePats[tSideOp] = getNewPath(aPipes.toArray(new MetaPipeEntity[0])); - aPreviousNode.mReturnPath = tConsumeNode.mNodePats[tSideOp]; + tConsumeNode.mNeighbourNodes[tSideOp] = aPreviousNode; + tConsumeNode.mNodePaths[tSideOp] = getNewPath(aPipes.toArray(new MetaPipeEntity[0])); + aPreviousNode.mReturnPath = tConsumeNode.mNodePaths[tSideOp]; tThisNode = tConsumeNode; } return tThisNode; } - //go over the pipes until we see a valid tileentity that needs a node + //go over the pipes until we see a valid tile entity that needs a node protected Pair getNextValidTileEntity(TileEntity aTileEntity, ArrayList<MetaPipeEntity> aPipes, byte aSide, HashSet<Node> aNodeMap) { if (isPipe(aTileEntity)) { BaseMetaPipeEntity tPipe = (BaseMetaPipeEntity) aTileEntity; @@ -112,8 +112,8 @@ abstract public class GenerateNodeMap { if (aNodeMap.contains(tNode)) return null; } - int tConections = getNumberOfConections(tMetaPipe); - if (tConections == 2) { + int tConnections = getNumberOfConnections(tMetaPipe); + if (tConnections == 2) { byte tSideOp = getOppositeSide(aSide); for (byte i = 0;i<6;i++) { if (i == tSideOp || !(tMetaPipe.isConnectedAtSide(i))) continue; @@ -144,16 +144,16 @@ abstract public class GenerateNodeMap { } } - //if check if the tileentity is the correct pipe + //if check if the tile entity is the correct pipe protected boolean isPipe(TileEntity aTileEntity) { return aTileEntity instanceof BaseMetaPipeEntity; } - //checks if the tileentity is a consumer and add to the list + //checks if the tile entity is a consumer and add to the list abstract protected boolean addConsumer(TileEntity aTileEntity, byte aSide, int aNodeValue, ArrayList<ConsumerNode> aConsumers); //get correct pathClass that you need for your node network protected abstract NodePath getNewPath(MetaPipeEntity[] aPipes); - //used for if you need to use death ends for somthing + //used for if you need to use death ends for something //can be null protected Node getEmptyNode(int aNodeValue, byte aSide, TileEntity aTileEntity, ArrayList<ConsumerNode> aConsumers) { return null; @@ -163,8 +163,8 @@ abstract public class GenerateNodeMap { return new Node(aNodeValue,aTileEntity,aConsumers); } - //get how many conections the pipe have - private static int getNumberOfConections(MetaPipeEntity aPipe) { + //get how many connections the pipe have + private static int getNumberOfConnections(MetaPipeEntity aPipe) { int tCons = 0; for (int i = 0; i < 6; i++) { if (aPipe.isConnectedAtSide(i)) tCons++; diff --git a/src/main/java/gregtech/api/graphs/GenerateNodeMapPower.java b/src/main/java/gregtech/api/graphs/GenerateNodeMapPower.java index ec5c984bc0..76a24e8802 100644 --- a/src/main/java/gregtech/api/graphs/GenerateNodeMapPower.java +++ b/src/main/java/gregtech/api/graphs/GenerateNodeMapPower.java @@ -17,7 +17,7 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.ArrayList; import java.util.HashSet; -//node map generator for power distrubution +//node map generator for power distribution public class GenerateNodeMapPower extends GenerateNodeMap { public GenerateNodeMapPower(BaseMetaPipeEntity aTileEntity) { generateNode(aTileEntity,null,1,null, diff --git a/src/main/java/gregtech/api/graphs/Node.java b/src/main/java/gregtech/api/graphs/Node.java index fed599881c..258915e473 100644 --- a/src/main/java/gregtech/api/graphs/Node.java +++ b/src/main/java/gregtech/api/graphs/Node.java @@ -12,8 +12,8 @@ public class Node { this.mNodeValue = aNodeValue; this.mTileEntity = aTileEntity; this.mConsumers = aConsumers; - mHigestNodeValue = aNodeValue; - //you dont want to generate map multiple times in the same tick + mHighestNodeValue = aNodeValue; + //you don't want to generate map multiple times in the same tick mCreationTime = MinecraftServer.getServer().getTickCounter(); } @@ -23,8 +23,8 @@ public class Node { public ArrayList<ConsumerNode> mConsumers; public int mNodeValue; public final TileEntity mTileEntity; - public Node[] mNeigbourNodes = new Node[6]; - public NodePath[] mNodePats = new NodePath[6]; + public Node[] mNeighbourNodes = new Node[6]; + public NodePath[] mNodePaths = new NodePath[6]; public NodePath mReturnPath; - public int mHigestNodeValue; + public int mHighestNodeValue; } diff --git a/src/main/java/gregtech/api/graphs/NodeList.java b/src/main/java/gregtech/api/graphs/NodeList.java index 702e8446c0..36ebbc4f6f 100644 --- a/src/main/java/gregtech/api/graphs/NodeList.java +++ b/src/main/java/gregtech/api/graphs/NodeList.java @@ -1,23 +1,23 @@ package gregtech.api.graphs; -//keep track on wich node is being looked for accrouse the recursif functions +//keep track on which node is being looked for across the recursive functions public class NodeList { Node[] mNodes; - int mConter = 0; + int mCounter = 0; public NodeList(Node[] mNodes) { this.mNodes = mNodes; } Node getNextNode() { - if (++mConter < mNodes.length) - return mNodes[mConter]; + if (++mCounter < mNodes.length) + return mNodes[mCounter]; else return null; } Node getNode() { - if (mConter < mNodes.length) - return mNodes[mConter]; + if (mCounter < mNodes.length) + return mNodes[mCounter]; else return null; } diff --git a/src/main/java/gregtech/api/graphs/PowerNodes.java b/src/main/java/gregtech/api/graphs/PowerNodes.java index 39844bdd17..411d690cca 100644 --- a/src/main/java/gregtech/api/graphs/PowerNodes.java +++ b/src/main/java/gregtech/api/graphs/PowerNodes.java @@ -12,9 +12,9 @@ import gregtech.api.graphs.paths.PowerNodePath; * this network only includes nodes that have a higher value then it self so it does not know the highest known value that * the return node knows * - * with these rules we can know what a node contains the target node in its network as long the target node has a value - * more or equal then the node we are looking but is less or equal then the highest value that node knows - * this way we don't have to go over the entire network too look for it + * with these rules we can know for the target node to be in the network of a node, the target node must have a value no + * less than the node we are looking and no greater than the highest value that node knows + * this way we don't have to go over the entire network to look for it * * we also hold a list of all consumers so we can check before looking if that consumer actually needs power * and only look for nodes that actually need power @@ -27,11 +27,11 @@ public class PowerNodes { ConsumerNode tConsumer =(ConsumerNode) aConsumers.getNode(); int tLoopProtection = 0; while (tConsumer != null) { - int tTagetNodeValue = tConsumer.mNodeValue; + int tTargetNodeValue = tConsumer.mNodeValue; //if the target node has a value less then the current node - if (tTagetNodeValue < aCurrentNode.mNodeValue || tTagetNodeValue > aCurrentNode.mHigestNodeValue) { + if (tTargetNodeValue < aCurrentNode.mNodeValue || tTargetNodeValue > aCurrentNode.mHighestNodeValue) { for (int j = 0;j<6;j++) { - Node tNextNode = aCurrentNode.mNeigbourNodes[j]; + Node tNextNode = aCurrentNode.mNeighbourNodes[j]; if (tNextNode != null && tNextNode.mNodeValue < aCurrentNode.mNodeValue) { if (tNextNode.mNodeValue == tConsumer.mNodeValue) { tAmpsUsed += processNodeInject(aCurrentNode,tConsumer,j,aMaxAmps-tAmpsUsed,aVoltage,false); @@ -46,16 +46,16 @@ public class PowerNodes { } } } else { - //if the target node has a node value greater then current node vale + //if the target node has a node value greater then current node value for (int side = 5;side>-1;side--) { - Node tNextNode = aCurrentNode.mNeigbourNodes[side]; + Node tNextNode = aCurrentNode.mNeighbourNodes[side]; if (tNextNode == null) continue; - if (tNextNode.mNodeValue > aCurrentNode.mNodeValue && tNextNode.mNodeValue < tTagetNodeValue) { + if (tNextNode.mNodeValue > aCurrentNode.mNodeValue && tNextNode.mNodeValue < tTargetNodeValue) { if (tNextNode == aPreviousNode) return tAmpsUsed; tAmpsUsed += processNextNodeAbove(aCurrentNode,tNextNode,aConsumers,side,aMaxAmps-tAmpsUsed,aVoltage); tConsumer =(ConsumerNode) aConsumers.getNode(); break; - } else if (tNextNode.mNodeValue == tTagetNodeValue) { + } else if (tNextNode.mNodeValue == tTargetNodeValue) { tAmpsUsed += processNodeInject(aCurrentNode,tConsumer,side,aMaxAmps-tAmpsUsed,aVoltage,true); tConsumer =(ConsumerNode) aConsumers.getNextNode(); break; @@ -66,32 +66,32 @@ public class PowerNodes { return tAmpsUsed; } if (tLoopProtection++ > 20) { - throw new NullPointerException("infinit loop in powering nodes "); + throw new NullPointerException("infinite loop in powering nodes "); } } return tAmpsUsed; } - //checking if target node is next to it ot has a higer value then current node value - //thse functions are difrent to eayer go down or up the stack + //checking if target node is next to it or has a higher value then current node value + //these functions are different to either go down or up the stack protected static int powerNodeAbove(Node aCurrentNode, Node aPreviousNode, NodeList aConsumers, int aVoltage, int aMaxAmps) { int tAmpsUsed = 0; int tLoopProtection = 0; ConsumerNode tConsumer =(ConsumerNode) aConsumers.getNode(); while (tConsumer != null) { - int tTagetNodeValue = tConsumer.mNodeValue; - if (tTagetNodeValue > aCurrentNode.mHigestNodeValue || tTagetNodeValue < aCurrentNode.mNodeValue) { + int tTargetNodeValue = tConsumer.mNodeValue; + if (tTargetNodeValue > aCurrentNode.mHighestNodeValue || tTargetNodeValue < aCurrentNode.mNodeValue) { return tAmpsUsed; } else { for (int side = 5;side>-1;side--) { - Node tNextNode = aCurrentNode.mNeigbourNodes[side]; + Node tNextNode = aCurrentNode.mNeighbourNodes[side]; if (tNextNode == null) continue; - if (tNextNode.mNodeValue > aCurrentNode.mNodeValue && tNextNode.mNodeValue < tTagetNodeValue) { + if (tNextNode.mNodeValue > aCurrentNode.mNodeValue && tNextNode.mNodeValue < tTargetNodeValue) { if (tNextNode == aPreviousNode) return tAmpsUsed; tAmpsUsed += processNextNodeAbove(aCurrentNode,tNextNode,aConsumers,side,aMaxAmps-tAmpsUsed,aVoltage); tConsumer =(ConsumerNode) aConsumers.getNode(); break; - } else if (tNextNode.mNodeValue == tTagetNodeValue) { + } else if (tNextNode.mNodeValue == tTargetNodeValue) { tAmpsUsed += processNodeInject(aCurrentNode,tConsumer,side,aMaxAmps-tAmpsUsed,aVoltage,true); tConsumer =(ConsumerNode) aConsumers.getNextNode(); break; @@ -102,14 +102,14 @@ public class PowerNodes { return tAmpsUsed; } if (tLoopProtection++ > 20) { - throw new NullPointerException("infinit loop in powering nodes "); + throw new NullPointerException("infinite loop in powering nodes "); } } return tAmpsUsed; } protected static int processNextNode(Node aCurrentNode, Node aNextNode, NodeList aConsumers, int aSide, int aMaxAmps, int aVoltage) { - PowerNodePath tPath = (PowerNodePath)aCurrentNode.mNodePats[aSide]; + PowerNodePath tPath = (PowerNodePath)aCurrentNode.mNodePaths[aSide]; PowerNodePath tSelfPath = (PowerNodePath) aCurrentNode.mSelfPath; int tVoltLoss = 0; if (tSelfPath != null) { @@ -126,7 +126,7 @@ public class PowerNodes { } protected static int processNextNodeAbove(Node aCurrentNode, Node aNextNode, NodeList aConsumers, int aSide, int aMaxAmps, int aVoltage) { - PowerNodePath tPath = (PowerNodePath)aCurrentNode.mNodePats[aSide]; + PowerNodePath tPath = (PowerNodePath)aCurrentNode.mNodePaths[aSide]; PowerNodePath tSelfPath = (PowerNodePath) aCurrentNode.mSelfPath; int tVoltLoss = 0; if (tSelfPath != null) { @@ -144,7 +144,7 @@ public class PowerNodes { protected static int processNodeInject(Node aCurrentNode, ConsumerNode aConsumer, int aSide,int aMaxAmps, int aVoltage, boolean isUp) { - PowerNodePath tPath = (PowerNodePath)aCurrentNode.mNodePats[aSide]; + PowerNodePath tPath = (PowerNodePath)aCurrentNode.mNodePaths[aSide]; PowerNodePath tSelfPath = (PowerNodePath) aCurrentNode.mSelfPath; int tVoltLoss = 0; if (tSelfPath != null) { diff --git a/src/main/java/gregtech/api/graphs/consumers/ConsumerNode.java b/src/main/java/gregtech/api/graphs/consumers/ConsumerNode.java index d2be4d94f1..87376008c4 100644 --- a/src/main/java/gregtech/api/graphs/consumers/ConsumerNode.java +++ b/src/main/java/gregtech/api/graphs/consumers/ConsumerNode.java @@ -5,7 +5,7 @@ import net.minecraft.tileentity.TileEntity; import java.util.ArrayList; -//node atached to a tileentity that can consume stuff from the network +//node attached to a tile entity that can consume stuff from the network public class ConsumerNode extends Node { public byte mSide; public ConsumerNode(int aNodeValue, TileEntity aTileEntity, byte aSide, ArrayList<ConsumerNode> aConsumers) { @@ -17,7 +17,7 @@ public class ConsumerNode extends Node { return !mTileEntity.isInvalid(); } - public int injectEnergy(int aVoltage, int aMaxApms) { + public int injectEnergy(int aVoltage, int aMaxAmps) { return 0; } } diff --git a/src/main/java/gregtech/api/graphs/consumers/EmptyPowerConsumer.java b/src/main/java/gregtech/api/graphs/consumers/EmptyPowerConsumer.java index 47e3bca144..da3d0a757b 100644 --- a/src/main/java/gregtech/api/graphs/consumers/EmptyPowerConsumer.java +++ b/src/main/java/gregtech/api/graphs/consumers/EmptyPowerConsumer.java @@ -6,7 +6,7 @@ import net.minecraft.tileentity.TileEntity; import java.util.ArrayList; -//this is here to aply voltage to death ends +//this is here to apply voltage to death ends public class EmptyPowerConsumer extends ConsumerNode{ public EmptyPowerConsumer(int aNodeValue, TileEntity aTileEntity, byte aSide, ArrayList<ConsumerNode> aConsumers) { super(aNodeValue, aTileEntity, aSide, aConsumers); @@ -18,7 +18,7 @@ public class EmptyPowerConsumer extends ConsumerNode{ } @Override - public int injectEnergy(int aVoltage, int aMaxApms) { + public int injectEnergy(int aVoltage, int aMaxAmps) { BaseMetaPipeEntity tPipe = (BaseMetaPipeEntity) mTileEntity; PowerNodePath tPath =(PowerNodePath) tPipe.getNodePath(); tPath.applyVoltage(aVoltage,true); diff --git a/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java b/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java index 099c7617f0..a24c4acbcd 100644 --- a/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java +++ b/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java @@ -23,7 +23,7 @@ public class NodeEnergyReceiver extends ConsumerNode { } @Override - public int injectEnergy(int aVoltage, int aMaxApms) { + public int injectEnergy(int aVoltage, int aMaxAmps) { ForgeDirection tDirection = ForgeDirection.getOrientation(mSide); int rfOut = GT_Utility.safeInt(aVoltage * GregTech_API.mEUtoRF / 100); int ampsUsed = 0; @@ -43,7 +43,7 @@ public class NodeEnergyReceiver extends ConsumerNode { return 0; } - //copyed from IEnergyConnected + //copied from IEnergyConnected private void explode(int aRfOut) { if (aRfOut > 32L * GregTech_API.mEUtoRF / 100L) { int aExplosionPower = aRfOut; diff --git a/src/main/java/gregtech/api/graphs/consumers/NodeEnergySink.java b/src/main/java/gregtech/api/graphs/consumers/NodeEnergySink.java index db9f383492..3f93c62010 100644 --- a/src/main/java/gregtech/api/graphs/consumers/NodeEnergySink.java +++ b/src/main/java/gregtech/api/graphs/consumers/NodeEnergySink.java @@ -18,9 +18,9 @@ public class NodeEnergySink extends ConsumerNode { } @Override - public int injectEnergy(int aVoltage, int aMaxApms) { + public int injectEnergy(int aVoltage, int aMaxAmps) { int tUsedAmps = 0; - while (aMaxApms > tUsedAmps && ((IEnergySink) mTileEntity).getDemandedEnergy() > 0 && + while (aMaxAmps > tUsedAmps && ((IEnergySink) mTileEntity).getDemandedEnergy() > 0 && ((IEnergySink) mTileEntity).injectEnergy(ForgeDirection.getOrientation(mSide), aVoltage, aVoltage) < aVoltage) tUsedAmps++; return tUsedAmps; diff --git a/src/main/java/gregtech/api/graphs/consumers/NodeGTBaseMetaTile.java b/src/main/java/gregtech/api/graphs/consumers/NodeGTBaseMetaTile.java index dbcc3c3b62..5c54ee16f9 100644 --- a/src/main/java/gregtech/api/graphs/consumers/NodeGTBaseMetaTile.java +++ b/src/main/java/gregtech/api/graphs/consumers/NodeGTBaseMetaTile.java @@ -11,8 +11,8 @@ public class NodeGTBaseMetaTile extends ConsumerNode { } @Override - public int injectEnergy(int aVoltage, int aMaxApms) { - return (int)((IEnergyConnected) mTileEntity).injectEnergyUnits(mSide,aVoltage, aMaxApms); + public int injectEnergy(int aVoltage, int aMaxAmps) { + return (int)((IEnergyConnected) mTileEntity).injectEnergyUnits(mSide,aVoltage, aMaxAmps); } @Override diff --git a/src/main/java/gregtech/api/graphs/paths/PowerNodePath.java b/src/main/java/gregtech/api/graphs/paths/PowerNodePath.java index 1120fe84e4..a91f9b10a8 100644 --- a/src/main/java/gregtech/api/graphs/paths/PowerNodePath.java +++ b/src/main/java/gregtech/api/graphs/paths/PowerNodePath.java @@ -6,7 +6,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Cable; import net.minecraft.server.MinecraftServer; //path for cables -//al calculations like ams and voltage hapens here +//all calculations like amp and voltage happens here public class PowerNodePath extends NodePath { int mMaxAmps; int mAmps = 0; @@ -60,7 +60,7 @@ public class PowerNodePath extends NodePath { } //if no amps pass trough for more then 0.5 second reduce them to minimize wrong results - //but still allow the player to see if activity is hapening + //but still allow the player to see if activity is happening public int getAmps() { int tTime = MinecraftServer.getServer().getTickCounter() - 10; if (mTick < tTime) { diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicMachine.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicMachine.java index a27ee175ef..bd28bb11e9 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicMachine.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicMachine.java @@ -1,6 +1,7 @@ package gregtech.api.gui; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_Bronze; import net.minecraft.entity.player.InventoryPlayer; import java.util.ArrayList; @@ -23,6 +24,8 @@ public class GT_GUIContainer_BasicMachine extends GT_GUIContainerMetaTile_Machin public final byte mProgressBarDirection, mProgressBarAmount; + public final boolean + mRenderAutoOutputSlots; public GT_GUIContainer_BasicMachine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile, String aNEI) { this(aInventoryPlayer, aTileEntity, aName, aTextureFile, aNEI, (byte) 0, (byte) 1); @@ -34,12 +37,15 @@ public class GT_GUIContainer_BasicMachine extends GT_GUIContainerMetaTile_Machin mProgressBarAmount = (byte) Math.max(1, aProgressBarAmount); mName = aName; mNEI = aNEI; + mRenderAutoOutputSlots = !(aTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_BasicMachine_Bronze); } @Override public void drawScreen(int par1, int par2, float par3) { super.drawScreen(par1, par2, par3); - drawTooltip(par1, par2); + if (mRenderAutoOutputSlots){ + drawTooltip(par1, par2); + } } @Override @@ -72,10 +78,12 @@ public class GT_GUIContainer_BasicMachine extends GT_GUIContainerMetaTile_Machin int y = (height - ySize) / 2; drawTexturedModalRect(x, y, 0, 0, xSize, ySize); if (mContainer != null) { - if (((GT_Container_BasicMachine) mContainer).mFluidTransfer) - drawTexturedModalRect(x + 7, y + 62, 176, 18, 18, 18); - if (((GT_Container_BasicMachine) mContainer).mItemTransfer) - drawTexturedModalRect(x + 25, y + 62, 176, 36, 18, 18); + if (mRenderAutoOutputSlots){ + if (((GT_Container_BasicMachine) mContainer).mFluidTransfer) + drawTexturedModalRect(x + 7, y + 62, 176, 18, 18, 18); + if (((GT_Container_BasicMachine) mContainer).mItemTransfer) + drawTexturedModalRect(x + 25, y + 62, 176, 36, 18, 18); + } if (((GT_Container_BasicMachine) mContainer).mStuttering) drawTexturedModalRect(x + 79, y + 44, 176, 54, 18, 18); diff --git a/src/main/java/gregtech/api/gui/GT_GUICover.java b/src/main/java/gregtech/api/gui/GT_GUICover.java index 1e51cf0758..2e9d082ebf 100644 --- a/src/main/java/gregtech/api/gui/GT_GUICover.java +++ b/src/main/java/gregtech/api/gui/GT_GUICover.java @@ -252,10 +252,17 @@ public abstract class GT_GUICover extends GuiScreen implements GT_IToolTipRender textBox.setFocused(textBox.equals(boxToFocus) && textBox.isEnabled()); } } + + /** + * Given textbox's value might have changed. + */ public void applyTextBox(GT_GuiIntegerTextBox box) { } + /** + * Reset the given textbox to the last valid value, <b>NOT</b> 0. + */ public void resetTextBox(GT_GuiIntegerTextBox box) { } diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java index 39cbee3aa9..b51377550b 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java @@ -283,14 +283,14 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE if (!hasValidMetaTileEntity()) return; } } - byte oldConections = mConnections; - // Mask-out Connection direction bits to keep only Foam related connections + byte oldConnections = mConnections; + // Mask-out connection direction bits to keep only Foam related connections mConnections = (byte) (mMetaTileEntity.mConnections | (mConnections & ~IConnectable.CONNECTED_ALL)); // If foam not hardened, tries roll chance to harden if ((mConnections & IConnectable.HAS_FOAM) == IConnectable.HAS_FRESHFOAM && getRandomNumber(1000) == 0) { mConnections = (byte) ((mConnections & ~IConnectable.HAS_FRESHFOAM) | IConnectable.HAS_HARDENEDFOAM); } - if (mTickTimer > 12 && oldConections != mConnections) + if (mTickTimer > 12 && oldConnections != mConnections) GregTech_API.causeCableUpdate(worldObj,xCoord,yCoord,zCoord); } case 8: diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java index 7c8efb88e0..a46157fb36 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java @@ -126,7 +126,7 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch { * @return true if stack is fully accepted. false is stack is partially accepted or nothing is accepted */ public boolean storeAll(ItemStack aStack) { - for (int i = 0, mInventoryLength = mInventory.length; i < mInventoryLength; i++) { + for (int i = 0, mInventoryLength = mInventory.length; i < mInventoryLength && aStack.stackSize > 0; i++) { ItemStack tSlot = mInventory[i]; if (GT_Utility.isStackInvalid(tSlot)) { if (aStack.stackSize <= getInventoryStackLimit()) { @@ -170,7 +170,8 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch { IInventory tTileEntity =aBaseMetaTileEntity.getIInventoryAtSide(aBaseMetaTileEntity.getFrontFacing()); if(tTileEntity!=null){ moveMultipleItemStacks(aBaseMetaTileEntity,tTileEntity,aBaseMetaTileEntity.getFrontFacing(),aBaseMetaTileEntity.getBackFacing(),null,false,(byte)64,(byte)1,(byte)64,(byte)1,mInventory.length); - + for (int i = 0; i < mInventory.length; i++) + if (mInventory[i] != null && mInventory[i].stackSize <= 0) mInventory[i] = null; // GT_Utility.moveOneItemStack(aBaseMetaTileEntity, tTileEntity, // aBaseMetaTileEntity.getFrontFacing(), aBaseMetaTileEntity.getBackFacing(), // null, false, (byte) 64, (byte) 1, (byte)( 64 * aBaseMetaTileEntity.getSizeInventory()), (byte) 1); diff --git a/src/main/java/gregtech/api/net/GT_Packet_WirelessRedstoneCover.java b/src/main/java/gregtech/api/net/GT_Packet_WirelessRedstoneCover.java new file mode 100644 index 0000000000..3ce0b48821 --- /dev/null +++ b/src/main/java/gregtech/api/net/GT_Packet_WirelessRedstoneCover.java @@ -0,0 +1,95 @@ +package gregtech.api.net; + +import com.google.common.io.ByteArrayDataInput; +import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import io.netty.buffer.ByteBuf; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.network.INetHandler; +import net.minecraft.network.NetHandlerPlayServer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.DimensionManager; + +public class GT_Packet_WirelessRedstoneCover extends GT_Packet_TileEntityCover { + private static final int PRIVATE_MASK = 0xFFFE0000; + private static final int PUBLIC_MASK = 0x0000FFFF; + private static final int CHECKBOX_MASK = 0x00010000; + + private EntityPlayerMP mPlayer; + private int mPublicChannel; + private int mCheckBoxValue; + + public GT_Packet_WirelessRedstoneCover() { + super(); + } + + public GT_Packet_WirelessRedstoneCover(int mX, short mY, int mZ, byte coverSide, int coverID, int dimID, int publicChannel, int checkBoxValue) { + super(mX, mY, mZ, coverSide, coverID, 0, dimID); + mPublicChannel = publicChannel; + mCheckBoxValue = checkBoxValue; + } + + public GT_Packet_WirelessRedstoneCover(byte coverSide, int coverID, ICoverable tile, int publicChannel, int checkBoxValue) { + super(coverSide, coverID, 0, tile); + mPublicChannel = publicChannel; + mCheckBoxValue = checkBoxValue; + } + + @Override + public byte getPacketID() { + return 10; + } + + @Override + public void setINetHandler(INetHandler aHandler) { + if (aHandler instanceof NetHandlerPlayServer) { + mPlayer = ((NetHandlerPlayServer) aHandler).playerEntity; + } + } + + @Override + public void encode(ByteBuf aOut) { + aOut.writeInt(mX); + aOut.writeShort(mY); + aOut.writeInt(mZ); + + aOut.writeByte(side); + aOut.writeInt(coverID); + + aOut.writeInt(dimID); + + aOut.writeInt(mPublicChannel); + aOut.writeInt(mCheckBoxValue); + } + + @Override + public GT_Packet_New decode(ByteArrayDataInput aData) { + return new GT_Packet_WirelessRedstoneCover( + aData.readInt(), + aData.readShort(), + aData.readInt(), + + aData.readByte(), + aData.readInt(), + + aData.readInt(), + + aData.readInt(), + aData.readInt()); + } + + @Override + public void process(IBlockAccess aWorld) { + World world = DimensionManager.getWorld(dimID); + if (world != null && world.blockExists(mX, mY, mZ)) { + TileEntity tile = world.getTileEntity(mX, mY, mZ); + if (tile instanceof IGregTechTileEntity && !((IGregTechTileEntity) tile).isDead()) { + int tPrivateChannel = (mCheckBoxValue > 0) ? mPlayer.getUniqueID().hashCode() & PRIVATE_MASK : 0; + int tCoverData = tPrivateChannel | (mCheckBoxValue & CHECKBOX_MASK) | (mPublicChannel & PUBLIC_MASK); + ((IGregTechTileEntity) tile).receiveCoverData(side, coverID, tCoverData); + } + } + } +} diff --git a/src/main/java/gregtech/api/threads/GT_Runnable_Cable_Update.java b/src/main/java/gregtech/api/threads/GT_Runnable_Cable_Update.java index 6bc42e9cc8..7093184533 100644 --- a/src/main/java/gregtech/api/threads/GT_Runnable_Cable_Update.java +++ b/src/main/java/gregtech/api/threads/GT_Runnable_Cable_Update.java @@ -21,18 +21,16 @@ public class GT_Runnable_Cable_Update extends GT_Runnable_MachineBlockUpdate { } } - @Override public void run() { try { while (!tQueue.isEmpty()) { final ChunkCoordinates aCoords = tQueue.poll(); final TileEntity tTileEntity; - final boolean isMachineBlock; GT_Proxy.TICK_LOCK.lock(); try { - //we dont want to go over cables that are in unloaded chuncks + //we dont want to go over cables that are in unloaded chunks //keeping the lock just to make sure no CME happens if (world.blockExists(aCoords.posX, aCoords.posY, aCoords.posZ)) { tTileEntity = world.getTileEntity(aCoords.posX, aCoords.posY, aCoords.posZ); @@ -48,7 +46,7 @@ public class GT_Runnable_Cable_Update extends GT_Runnable_MachineBlockUpdate { ((IMachineBlockUpdateable) tTileEntity).onMachineBlockUpdate(); // Now see if we should add the nearby blocks to the queue: - //only add blocks wich the cable is conected too + // only add blocks the cable is connected to if (tTileEntity instanceof BaseMetaPipeEntity && ((BaseMetaPipeEntity) tTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable) { diff --git a/src/main/java/gregtech/api/util/GT_CoverBehavior.java b/src/main/java/gregtech/api/util/GT_CoverBehavior.java index 08092cd31e..ebd3a98d55 100644 --- a/src/main/java/gregtech/api/util/GT_CoverBehavior.java +++ b/src/main/java/gregtech/api/util/GT_CoverBehavior.java @@ -57,6 +57,7 @@ public abstract class GT_CoverBehavior { */ public boolean onCoverShiftRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer) { if(hasCoverGUI() && aPlayer instanceof EntityPlayerMP) { + lastPlayer = aPlayer; GT_Values.NW.sendToPlayer(new GT_Packet_TileEntityCoverGUI(aSide, aCoverID, aCoverVariable, aTileEntity, (EntityPlayerMP) aPlayer), (EntityPlayerMP) aPlayer); return true; } diff --git a/src/main/java/gregtech/api/util/GT_OreDictUnificator.java b/src/main/java/gregtech/api/util/GT_OreDictUnificator.java index 4a5ca9070b..98809bbf45 100644 --- a/src/main/java/gregtech/api/util/GT_OreDictUnificator.java +++ b/src/main/java/gregtech/api/util/GT_OreDictUnificator.java @@ -448,7 +448,6 @@ public class GT_OreDictUnificator { public static ItemStack getIngotOrDust(MaterialStack aMaterial) { ItemStack rStack = getIngot(aMaterial); - if(aMaterial!=null&&aMaterial.mMaterial!=null&&(aMaterial.mMaterial==Materials.Naquadah||aMaterial.mMaterial==Materials.NaquadahEnriched))rStack = getDust(aMaterial); if (rStack == null) rStack = getDust(aMaterial); return rStack; } diff --git a/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java b/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java index cbaea6af3a..0868ff41c8 100644 --- a/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java +++ b/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java @@ -260,14 +260,15 @@ public class GT_RecipeRegistrator { long tAmount = 0; for (MaterialStack tMaterial : aData.getAllMaterialStacks()) tAmount += tMaterial.mAmount * tMaterial.mMaterial.getMass(); - boolean tHide = (aData.mMaterial.mMaterial != Materials.Iron)&&(GT_Mod.gregtechproxy.mHideRecyclingRecipes); + boolean tHide = (aData.mMaterial.mMaterial != Materials.Iron) && (GT_Mod.gregtechproxy.mHideRecyclingRecipes); RA.addPulveriserRecipe(aStack, new ItemStack[]{GT_OreDictUnificator.getDust(aData.mMaterial), GT_OreDictUnificator.getDust(aData.getByProduct(0)), GT_OreDictUnificator.getDust(aData.getByProduct(1)), GT_OreDictUnificator.getDust(aData.getByProduct(2))}, null, aData.mMaterial.mMaterial==Materials.Marble ? 1 : (int) Math.max(16, tAmount / M), 4, tHide); - if (aAllowHammer) for (MaterialStack tMaterial : aData.getAllMaterialStacks()) - if (tMaterial.mMaterial.contains(SubTag.CRYSTAL) && !tMaterial.mMaterial.contains(SubTag.METAL) && tMaterial.mMaterial != Materials.Glass) { - if (RA.addForgeHammerRecipe(GT_Utility.copyAmount(1, aStack), GT_OreDictUnificator.getDust(aData.mMaterial), 200, 30)) - break; - } + if (aAllowHammer) + for (MaterialStack tMaterial : aData.getAllMaterialStacks()) + if (tMaterial.mMaterial.contains(SubTag.CRYSTAL) && !tMaterial.mMaterial.contains(SubTag.METAL) && tMaterial.mMaterial != Materials.Glass) { + if (RA.addForgeHammerRecipe(GT_Utility.copyAmount(1, aStack), GT_OreDictUnificator.getDust(aData.mMaterial), 200, 30)) + break; + } ItemStack tDust = GT_OreDictUnificator.getDust(aData.mMaterial); if (tDust != null && GT_ModHandler.addPulverisationRecipe(GT_Utility.copyAmount(1, aStack), tDust, GT_OreDictUnificator.getDust(aData.getByProduct(0)), 100, GT_OreDictUnificator.getDust(aData.getByProduct(1)), 100, true)) { if (GregTech_API.sThaumcraftCompat != null) diff --git a/src/main/java/gregtech/api/util/GT_SpawnEventHandler.java b/src/main/java/gregtech/api/util/GT_SpawnEventHandler.java index 9063b1f7c9..0e29950dbd 100644 --- a/src/main/java/gregtech/api/util/GT_SpawnEventHandler.java +++ b/src/main/java/gregtech/api/util/GT_SpawnEventHandler.java @@ -9,12 +9,12 @@ import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingSpawnEvent.CheckSpawn; -import java.util.ArrayList; import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; public class GT_SpawnEventHandler { - public static volatile List<int[]> mobReps = new ArrayList(); + public static volatile List<int[]> mobReps = new CopyOnWriteArrayList<>(); public GT_SpawnEventHandler() { MinecraftForge.EVENT_BUS.register(this); diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index e9a9d6a436..8cbb44fe07 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -886,13 +886,16 @@ public class GT_Utility { public static boolean listContainsItem(Collection<ItemStack> aList, ItemStack aStack, boolean aTIfListEmpty, boolean aInvertFilter) { if (aStack == null || aStack.stackSize < 1) return false; if (aList == null) return aTIfListEmpty; - aList.removeIf(Objects::isNull); - if (aList.size() < 1) return aTIfListEmpty; - Iterator<ItemStack> tIterator = aList.iterator(); - ItemStack tStack = null; - while (tIterator.hasNext()) - if ((tStack = tIterator.next()) != null && areStacksEqual(aStack, tStack)) return !aInvertFilter; - return aInvertFilter; + boolean tEmpty = true; + for (ItemStack tStack : aList) { + if (tStack != null) { + tEmpty = false; + if (areStacksEqual(aStack, tStack)) { + return !aInvertFilter; + } + } + } + return tEmpty ? aTIfListEmpty : aInvertFilter; } public static boolean areStacksOrToolsEqual(ItemStack aStack1, ItemStack aStack2) { |