diff options
author | Raven Szewczyk <git@eigenraven.me> | 2023-04-10 17:49:16 +0100 |
---|---|---|
committer | Raven Szewczyk <git@eigenraven.me> | 2023-04-10 17:49:16 +0100 |
commit | 8ac58626bd4caa9e49f58acc6b97ac031f6c2107 (patch) | |
tree | 0a8c7b737f1f2607fa6875309f4c6a5c2b8b3331 /src/main/java/gregtech/api/graphs | |
parent | d795cf740c3b48b602d3bfb708ed9e6c492ad37d (diff) | |
download | GT5-Unofficial-8ac58626bd4caa9e49f58acc6b97ac031f6c2107.tar.gz GT5-Unofficial-8ac58626bd4caa9e49f58acc6b97ac031f6c2107.tar.bz2 GT5-Unofficial-8ac58626bd4caa9e49f58acc6b97ac031f6c2107.zip |
Update spotless config to 0.2.2
Diffstat (limited to 'src/main/java/gregtech/api/graphs')
9 files changed, 63 insertions, 65 deletions
diff --git a/src/main/java/gregtech/api/graphs/GenerateNodeMap.java b/src/main/java/gregtech/api/graphs/GenerateNodeMap.java index b64020f33d..bbdfa40a10 100644 --- a/src/main/java/gregtech/api/graphs/GenerateNodeMap.java +++ b/src/main/java/gregtech/api/graphs/GenerateNodeMap.java @@ -50,7 +50,7 @@ public abstract class GenerateNodeMap { // gets the next node protected void generateNextNode(BaseMetaPipeEntity aPipe, Node aPipeNode, byte aInvalidSide, int aNextNodeValue, - ArrayList<ConsumerNode> tConsumers, HashSet<Node> tNodeMap) { + ArrayList<ConsumerNode> tConsumers, HashSet<Node> tNodeMap) { final MetaPipeEntity tMetaPipe = (MetaPipeEntity) aPipe.getMetaTileEntity(); for (byte side : ALL_VALID_SIDES) { if (side == aInvalidSide) { @@ -62,13 +62,13 @@ public abstract class GenerateNodeMap { final Pair nextTileEntity = getNextValidTileEntity(tNextTileEntity, tNewPipes, side, tNodeMap); if (nextTileEntity != null) { final Node tNextNode = generateNode( - nextTileEntity.mTileEntity, - aPipeNode, - aNextNodeValue + 1, - tNewPipes, - nextTileEntity.mSide, - tConsumers, - tNodeMap); + nextTileEntity.mTileEntity, + aPipeNode, + aNextNodeValue + 1, + tNewPipes, + nextTileEntity.mSide, + tConsumers, + tNodeMap); if (tNextNode != null) { aNextNodeValue = tNextNode.mHighestNodeValue; aPipeNode.mHighestNodeValue = tNextNode.mHighestNodeValue; @@ -84,7 +84,7 @@ public abstract class GenerateNodeMap { // 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) { + ArrayList<MetaPipeEntity> aPipes, int aSide, ArrayList<ConsumerNode> aConsumers, HashSet<Node> aNodeMap) { if (aTileEntity.isInvalid()) return null; final byte tSideOp = getOppositeSide(aSide); final byte tInvalidSide = aPreviousNode == null ? -1 : tSideOp; @@ -130,7 +130,7 @@ public abstract class GenerateNodeMap { // 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) { + HashSet<Node> aNodeMap) { if (isPipe(aTileEntity)) { final BaseMetaPipeEntity tPipe = (BaseMetaPipeEntity) aTileEntity; final MetaPipeEntity tMetaPipe = (MetaPipeEntity) tPipe.getMetaTileEntity(); @@ -168,14 +168,14 @@ public abstract class GenerateNodeMap { // checks if the tile entity is a consumer and add to the list protected abstract boolean addConsumer(TileEntity aTileEntity, byte aSide, int aNodeValue, - ArrayList<ConsumerNode> aConsumers); + 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 dead ends for something can be null protected Node getEmptyNode(int aNodeValue, byte aSide, TileEntity aTileEntity, - ArrayList<ConsumerNode> aConsumers) { + ArrayList<ConsumerNode> aConsumers) { return null; } diff --git a/src/main/java/gregtech/api/graphs/GenerateNodeMapPower.java b/src/main/java/gregtech/api/graphs/GenerateNodeMapPower.java index 67591040e9..f2a2e95df8 100644 --- a/src/main/java/gregtech/api/graphs/GenerateNodeMapPower.java +++ b/src/main/java/gregtech/api/graphs/GenerateNodeMapPower.java @@ -33,12 +33,12 @@ public class GenerateNodeMapPower extends GenerateNodeMap { @Override protected boolean isPipe(TileEntity aTileEntity) { return super.isPipe(aTileEntity) - && ((BaseMetaPipeEntity) aTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable; + && ((BaseMetaPipeEntity) aTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable; } @Override protected boolean addConsumer(TileEntity aTileEntity, byte aSide, int aNodeValue, - ArrayList<ConsumerNode> aConsumers) { + ArrayList<ConsumerNode> aConsumers) { if (aTileEntity instanceof BaseMetaTileEntity tBaseTileEntity) { if (tBaseTileEntity.inputEnergyFrom(aSide, false)) { ConsumerNode tConsumerNode = new NodeGTBaseMetaTile(aNodeValue, tBaseTileEntity, aSide, aConsumers); @@ -61,25 +61,25 @@ public class GenerateNodeMapPower extends GenerateNodeMap { boolean crossesChuncks = dX >> 4 != aTileEntity.xCoord >> 4 || dZ >> 4 != aTileEntity.zCoord >> 4; TileEntity tNextTo = null; if (!crossesChuncks || !aTileEntity.getWorldObj() - .blockExists(dX, dY, dZ)) + .blockExists(dX, dY, dZ)) tNextTo = aTileEntity.getWorldObj() - .getTileEntity(dX, dY, dZ); + .getTileEntity(dX, dY, dZ); if (((IEnergySink) aTileEntity).acceptsEnergyFrom(tNextTo, ForgeDirection.getOrientation(aSide))) { ConsumerNode tConsumerNode = new NodeEnergySink( - aNodeValue, - (IEnergySink) aTileEntity, - aSide, - aConsumers); + aNodeValue, + (IEnergySink) aTileEntity, + aSide, + aConsumers); aConsumers.add(tConsumerNode); return true; } } else if (GregTech_API.mOutputRF && aTileEntity instanceof IEnergyReceiver) { ConsumerNode tConsumerNode = new NodeEnergyReceiver( - aNodeValue, - (IEnergyReceiver) aTileEntity, - aSide, - aConsumers); + aNodeValue, + (IEnergyReceiver) aTileEntity, + aSide, + aConsumers); aConsumers.add(tConsumerNode); return true; } @@ -94,7 +94,7 @@ public class GenerateNodeMapPower extends GenerateNodeMap { // used to apply voltage on dead ends @Override protected Node getEmptyNode(int aNodeValue, byte aSide, TileEntity aTileEntity, - ArrayList<ConsumerNode> aConsumers) { + ArrayList<ConsumerNode> aConsumers) { ConsumerNode tNode = new EmptyPowerConsumer(aNodeValue, aTileEntity, aSide, aConsumers); aConsumers.add(tNode); return tNode; diff --git a/src/main/java/gregtech/api/graphs/Node.java b/src/main/java/gregtech/api/graphs/Node.java index 005b32a5b7..9afe009d3e 100644 --- a/src/main/java/gregtech/api/graphs/Node.java +++ b/src/main/java/gregtech/api/graphs/Node.java @@ -18,7 +18,7 @@ public class Node { mHighestNodeValue = aNodeValue; // you don't want to generate map multiple times in the same tick mCreationTime = MinecraftServer.getServer() - .getTickCounter(); + .getTickCounter(); } public final TileEntity mTileEntity; diff --git a/src/main/java/gregtech/api/graphs/PowerNodes.java b/src/main/java/gregtech/api/graphs/PowerNodes.java index 22f1e02add..be94d2312a 100644 --- a/src/main/java/gregtech/api/graphs/PowerNodes.java +++ b/src/main/java/gregtech/api/graphs/PowerNodes.java @@ -16,7 +16,7 @@ public class PowerNodes { // check if the looked for node is next to or get the next node that is closer to it public static long powerNode(Node aCurrentNode, Node aPreviousNode, NodeList aConsumers, long aVoltage, - long aMaxAmps) { + long aMaxAmps) { long tAmpsUsed = 0; ConsumerNode tConsumer = (ConsumerNode) aConsumers.getNode(); int tLoopProtection = 0; @@ -33,12 +33,12 @@ public class PowerNodes { } else { if (aPreviousNode == tNextNode) return tAmpsUsed; tAmpsUsed += processNextNode( - aCurrentNode, - tNextNode, - aConsumers, - j, - aMaxAmps - tAmpsUsed, - aVoltage); + aCurrentNode, + tNextNode, + aConsumers, + j, + aMaxAmps - tAmpsUsed, + aVoltage); tConsumer = (ConsumerNode) aConsumers.getNode(); } break; @@ -52,12 +52,12 @@ public class PowerNodes { if (tNextNode.mNodeValue > aCurrentNode.mNodeValue && tNextNode.mNodeValue < tTargetNodeValue) { if (tNextNode == aPreviousNode) return tAmpsUsed; tAmpsUsed += processNextNodeAbove( - aCurrentNode, - tNextNode, - aConsumers, - side, - aMaxAmps - tAmpsUsed, - aVoltage); + aCurrentNode, + tNextNode, + aConsumers, + side, + aMaxAmps - tAmpsUsed, + aVoltage); tConsumer = (ConsumerNode) aConsumers.getNode(); break; } else if (tNextNode.mNodeValue == tTargetNodeValue) { @@ -80,7 +80,7 @@ public class PowerNodes { // 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 long powerNodeAbove(Node aCurrentNode, Node aPreviousNode, NodeList aConsumers, long aVoltage, - long aMaxAmps) { + long aMaxAmps) { long tAmpsUsed = 0; int tLoopProtection = 0; ConsumerNode tConsumer = (ConsumerNode) aConsumers.getNode(); @@ -95,12 +95,12 @@ public class PowerNodes { if (tNextNode.mNodeValue > aCurrentNode.mNodeValue && tNextNode.mNodeValue < tTargetNodeValue) { if (tNextNode == aPreviousNode) return tAmpsUsed; tAmpsUsed += processNextNodeAbove( - aCurrentNode, - tNextNode, - aConsumers, - side, - aMaxAmps - tAmpsUsed, - aVoltage); + aCurrentNode, + tNextNode, + aConsumers, + side, + aMaxAmps - tAmpsUsed, + aVoltage); tConsumer = (ConsumerNode) aConsumers.getNode(); break; } else if (tNextNode.mNodeValue == tTargetNodeValue) { @@ -121,7 +121,7 @@ public class PowerNodes { } protected static long processNextNode(Node aCurrentNode, Node aNextNode, NodeList aConsumers, int aSide, - long aMaxAmps, long aVoltage) { + long aMaxAmps, long aVoltage) { if (aCurrentNode.locks[aSide].isLocked()) { aConsumers.getNextNode(); return 0; @@ -142,7 +142,7 @@ public class PowerNodes { } protected static long processNextNodeAbove(Node aCurrentNode, Node aNextNode, NodeList aConsumers, int aSide, - long aMaxAmps, long aVoltage) { + long aMaxAmps, long aVoltage) { if (aCurrentNode.locks[aSide].isLocked()) { aConsumers.getNextNode(); return 0; @@ -163,7 +163,7 @@ public class PowerNodes { } protected static long processNodeInject(Node aCurrentNode, ConsumerNode aConsumer, int aSide, long aMaxAmps, - long aVoltage) { + long aVoltage) { if (aCurrentNode.locks[aSide].isLocked()) return 0; final PowerNodePath tPath = (PowerNodePath) aCurrentNode.mNodePaths[aSide]; final PowerNodePath tSelfPath = (PowerNodePath) aCurrentNode.mSelfPath; diff --git a/src/main/java/gregtech/api/graphs/consumers/NodeEnergyConnected.java b/src/main/java/gregtech/api/graphs/consumers/NodeEnergyConnected.java index bd2087de84..65dd50f9df 100644 --- a/src/main/java/gregtech/api/graphs/consumers/NodeEnergyConnected.java +++ b/src/main/java/gregtech/api/graphs/consumers/NodeEnergyConnected.java @@ -9,7 +9,7 @@ import gregtech.api.interfaces.tileentity.IEnergyConnected; public class NodeEnergyConnected extends ConsumerNode { public NodeEnergyConnected(int aNodeValue, IEnergyConnected aTileEntity, byte aSide, - ArrayList<ConsumerNode> aConsumers) { + ArrayList<ConsumerNode> aConsumers) { super(aNodeValue, (TileEntity) aTileEntity, aSide, aConsumers); } diff --git a/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java b/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java index fec34c9d66..4e84b04e2a 100644 --- a/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java +++ b/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java @@ -22,7 +22,7 @@ public class NodeEnergyReceiver extends ConsumerNode { int mRestRF = 0; public NodeEnergyReceiver(int aNodeValue, IEnergyReceiver aTileEntity, byte aSide, - ArrayList<ConsumerNode> aConsumers) { + ArrayList<ConsumerNode> aConsumers) { super(aNodeValue, (TileEntity) aTileEntity, aSide, aConsumers); } @@ -41,7 +41,7 @@ public class NodeEnergyReceiver extends ConsumerNode { return ampsUsed; } if (GregTech_API.mRFExplosions && GregTech_API.sMachineExplosions - && ((IEnergyReceiver) mTileEntity).getMaxEnergyStored(tDirection) < rfOut * 600L) { + && ((IEnergyReceiver) mTileEntity).getMaxEnergyStored(tDirection) < rfOut * 600L) { explode(rfOut); } return 0; @@ -55,15 +55,14 @@ public class NodeEnergyReceiver extends ConsumerNode { World tWorld = mTileEntity.getWorldObj(); GT_Utility.sendSoundToPlayers(tWorld, SoundResource.IC2_MACHINES_MACHINE_OVERLOAD, 1.0F, -1, tX, tY, tZ); tWorld.setBlock(tX, tY, tZ, Blocks.air); - if (GregTech_API.sMachineExplosions) if (GT_Mod.gregtechproxy.mPollution) GT_Pollution.addPollution( - tWorld.getChunkFromBlockCoords(tX, tZ), - GT_Mod.gregtechproxy.mPollutionOnExplosion); + if (GregTech_API.sMachineExplosions) if (GT_Mod.gregtechproxy.mPollution) GT_Pollution + .addPollution(tWorld.getChunkFromBlockCoords(tX, tZ), GT_Mod.gregtechproxy.mPollutionOnExplosion); new WorldSpawnedEventBuilder.ExplosionEffectEventBuilder().setStrength(tStrength) - .setSmoking(true) - .setPosition(tX + 0.5, tY + 0.5, tZ + 0.5) - .setWorld(tWorld) - .run(); + .setSmoking(true) + .setPosition(tX + 0.5, tY + 0.5, tZ + 0.5) + .setWorld(tWorld) + .run(); } } } diff --git a/src/main/java/gregtech/api/graphs/consumers/NodeEnergySink.java b/src/main/java/gregtech/api/graphs/consumers/NodeEnergySink.java index 16b8f99939..d978a99d0b 100644 --- a/src/main/java/gregtech/api/graphs/consumers/NodeEnergySink.java +++ b/src/main/java/gregtech/api/graphs/consumers/NodeEnergySink.java @@ -23,8 +23,8 @@ public class NodeEnergySink extends ConsumerNode { public int injectEnergy(long aVoltage, long aMaxAmps) { int tUsedAmps = 0; while (aMaxAmps > tUsedAmps && ((IEnergySink) mTileEntity).getDemandedEnergy() > 0 - && ((IEnergySink) mTileEntity).injectEnergy(ForgeDirection.getOrientation(mSide), aVoltage, aVoltage) - < aVoltage) + && ((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 19a2478c07..ec75468db5 100644 --- a/src/main/java/gregtech/api/graphs/consumers/NodeGTBaseMetaTile.java +++ b/src/main/java/gregtech/api/graphs/consumers/NodeGTBaseMetaTile.java @@ -9,7 +9,7 @@ import gregtech.api.metatileentity.BaseMetaTileEntity; public class NodeGTBaseMetaTile extends ConsumerNode { public NodeGTBaseMetaTile(int aNodeValue, BaseMetaTileEntity aTileEntity, byte aSide, - ArrayList<ConsumerNode> aConsumers) { + ArrayList<ConsumerNode> aConsumers) { super(aNodeValue, aTileEntity, aSide, aConsumers); } diff --git a/src/main/java/gregtech/api/graphs/paths/PowerNodePath.java b/src/main/java/gregtech/api/graphs/paths/PowerNodePath.java index 97edd5757c..a232822b26 100644 --- a/src/main/java/gregtech/api/graphs/paths/PowerNodePath.java +++ b/src/main/java/gregtech/api/graphs/paths/PowerNodePath.java @@ -28,7 +28,7 @@ public class PowerNodePath extends NodePath { public void applyVoltage(long aVoltage, boolean aCountUp) { int tNewTime = MinecraftServer.getServer() - .getTickCounter(); + .getTickCounter(); if (mTick != tNewTime) { reset(tNewTime - mTick); mTick = tNewTime; @@ -78,8 +78,7 @@ public class PowerNodePath extends NodePath { // but still allow the player to see if activity is happening public long getAmps() { int tTime = MinecraftServer.getServer() - .getTickCounter() - - 10; + .getTickCounter() - 10; if (mTick < tTime) { reset(tTime - mTick); mTick = tTime; |