aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/tileentities/machines/long_distance
diff options
context:
space:
mode:
authorRaven Szewczyk <git@eigenraven.me>2022-08-27 10:19:57 +0100
committerGitHub <noreply@github.com>2022-08-27 11:19:57 +0200
commit6f31720697bcc351421a4d86ba3bf749375dd12c (patch)
tree3adf8f318f22c892d74cd7c9d30b6dd3f11f11bd /src/main/java/gregtech/common/tileentities/machines/long_distance
parentc3eac50decd33ee2be8703dfb2ecf9cdc31c2b67 (diff)
downloadGT5-Unofficial-6f31720697bcc351421a4d86ba3bf749375dd12c.tar.gz
GT5-Unofficial-6f31720697bcc351421a4d86ba3bf749375dd12c.tar.bz2
GT5-Unofficial-6f31720697bcc351421a4d86ba3bf749375dd12c.zip
Update buildscript & apply spotless (#1306)
* Update dependencies * Update buildscript, apply spotless
Diffstat (limited to 'src/main/java/gregtech/common/tileentities/machines/long_distance')
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineBase.java191
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineFluid.java58
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineItem.java69
3 files changed, 179 insertions, 139 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineBase.java b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineBase.java
index a74f8123ec..143548cfaa 100644
--- a/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineBase.java
+++ b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineBase.java
@@ -19,9 +19,15 @@
* You should have received a copy of the GNU Lesser General Public License
* along with GregTech. If not, see <http://www.gnu.org/licenses/>.
*/
-
package gregtech.common.tileentities.machines.long_distance;
+import static mcp.mobius.waila.api.SpecialChars.BLUE;
+import static mcp.mobius.waila.api.SpecialChars.GOLD;
+import static mcp.mobius.waila.api.SpecialChars.GREEN;
+import static mcp.mobius.waila.api.SpecialChars.RED;
+import static mcp.mobius.waila.api.SpecialChars.RESET;
+import static mcp.mobius.waila.api.SpecialChars.YELLOW;
+
import gregtech.api.GregTech_API;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
@@ -30,6 +36,13 @@ import gregtech.api.items.GT_Block_LongDistancePipe;
import gregtech.api.metatileentity.BaseMetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicHull_NonElectric;
import gregtech.api.util.GT_Utility;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Queue;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import net.minecraft.block.Block;
@@ -42,32 +55,19 @@ import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Queue;
-
-import static mcp.mobius.waila.api.SpecialChars.BLUE;
-import static mcp.mobius.waila.api.SpecialChars.GOLD;
-import static mcp.mobius.waila.api.SpecialChars.GREEN;
-import static mcp.mobius.waila.api.SpecialChars.RED;
-import static mcp.mobius.waila.api.SpecialChars.RESET;
-import static mcp.mobius.waila.api.SpecialChars.YELLOW;
-
public abstract class GT_MetaTileEntity_LongDistancePipelineBase extends GT_MetaTileEntity_BasicHull_NonElectric {
public static int minimalDistancePoints = 64;
protected GT_MetaTileEntity_LongDistancePipelineBase mTarget = null, mSender = null;
protected ChunkCoordinates mTargetPos = null;
protected GT_MetaTileEntity_LongDistancePipelineBase mTooCloseTarget = null, mTooCloseSender = null;
- public GT_MetaTileEntity_LongDistancePipelineBase(int aID, String aName, String aNameRegional, int aTier, String aDescription) {
+ public GT_MetaTileEntity_LongDistancePipelineBase(
+ int aID, String aName, String aNameRegional, int aTier, String aDescription) {
super(aID, aName, aNameRegional, aTier, aDescription);
}
- public GT_MetaTileEntity_LongDistancePipelineBase(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_LongDistancePipelineBase(
+ String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
super(aName, aTier, aDescription, aTextures);
}
@@ -87,12 +87,8 @@ public abstract class GT_MetaTileEntity_LongDistancePipelineBase extends GT_Meta
super.loadNBTData(aNBT);
if (aNBT.hasKey("target")) {
mTargetPos = new ChunkCoordinates(
- aNBT.getInteger("target.x"),
- aNBT.getInteger("target.y"),
- aNBT.getInteger("target.z")
- );
- if (getDistanceToSelf(mTargetPos) < minimalDistancePoints)
- mTargetPos = null;
+ aNBT.getInteger("target.x"), aNBT.getInteger("target.y"), aNBT.getInteger("target.z"));
+ if (getDistanceToSelf(mTargetPos) < minimalDistancePoints) mTargetPos = null;
}
}
@@ -133,23 +129,26 @@ public abstract class GT_MetaTileEntity_LongDistancePipelineBase extends GT_Meta
// Only check if the target position is loaded
TileEntity te = world.getTileEntity(mTargetPos.posX, mTargetPos.posY, mTargetPos.posZ);
final IMetaTileEntity tMeta;
- if (te instanceof BaseMetaTileEntity &&
- ((tMeta = ((BaseMetaTileEntity)te).getMetaTileEntity()) instanceof GT_MetaTileEntity_LongDistancePipelineBase) &&
- isSameClass((GT_MetaTileEntity_LongDistancePipelineBase)tMeta))
- {
+ if (te instanceof BaseMetaTileEntity
+ && ((tMeta = ((BaseMetaTileEntity) te).getMetaTileEntity())
+ instanceof GT_MetaTileEntity_LongDistancePipelineBase)
+ && isSameClass((GT_MetaTileEntity_LongDistancePipelineBase) tMeta)) {
// It's the right type!
- mTarget = (GT_MetaTileEntity_LongDistancePipelineBase)tMeta;
- }
- else if (te != null) {
+ mTarget = (GT_MetaTileEntity_LongDistancePipelineBase) tMeta;
+ } else if (te != null) {
// It isn't the right type, kill the target position
mTargetPos = null;
}
}
}
- if (mTooCloseTarget != null && mTooCloseTarget.mSender == null) mTooCloseTarget.mTooCloseSender = this;
- if (mTooCloseSender != null && (mTooCloseSender.isDead() || mTooCloseSender.mTarget != null)) mTooCloseSender = null;
+ if (mTooCloseTarget != null && mTooCloseTarget.mSender == null) mTooCloseTarget.mTooCloseSender = this;
+ if (mTooCloseSender != null && (mTooCloseSender.isDead() || mTooCloseSender.mTarget != null))
+ mTooCloseSender = null;
if (mTarget == null || mTarget == this) return false;
- if (mTarget.mSender == null || mTarget.mSender.isDead() || mTarget.mSender.mTarget == null || mTarget.mSender.mTarget.isDead()) {
+ if (mTarget.mSender == null
+ || mTarget.mSender.isDead()
+ || mTarget.mSender.mTarget == null
+ || mTarget.mSender.mTarget.isDead()) {
mTarget.mSender = this;
mTarget.mTooCloseSender = null;
}
@@ -158,19 +157,20 @@ public abstract class GT_MetaTileEntity_LongDistancePipelineBase extends GT_Meta
}
@Override
- public ArrayList<String> getSpecialDebugInfo(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, int aLogLevel, ArrayList<String> aList) {
+ public ArrayList<String> getSpecialDebugInfo(
+ IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, int aLogLevel, ArrayList<String> aList) {
if (mSender != null && !mSender.isDead() && mSender.mTarget == this) {
final ChunkCoordinates coords = mSender.getCoords();
- aList.addAll(Arrays.asList("Is the Target", "Sender is at: X: " + coords.posX + " Y: " + coords.posY + " Z: " + coords.posZ));
+ aList.addAll(Arrays.asList(
+ "Is the Target", "Sender is at: X: " + coords.posX + " Y: " + coords.posY + " Z: " + coords.posZ));
} else {
- aList.addAll(
- Arrays.asList(checkTarget() ? "Has Target" : "Has no loaded Target",
- "Target should be around: X: " + mTargetPos.posX + " Y: " + mTargetPos.posY + " Z: " + mTargetPos.posZ
- ));
+ aList.addAll(Arrays.asList(
+ checkTarget() ? "Has Target" : "Has no loaded Target",
+ "Target should be around: X: " + mTargetPos.posX + " Y: " + mTargetPos.posY + " Z: "
+ + mTargetPos.posZ));
}
return aList;
-
}
// What meta should the pipes for this pipeline have
@@ -193,44 +193,55 @@ public abstract class GT_MetaTileEntity_LongDistancePipelineBase extends GT_Meta
// Start scanning from the output side
Block aBlock = gtTile.getBlockAtSide(gtTile.getBackFacing());
- if(aBlock instanceof GT_Block_LongDistancePipe) {
+ if (aBlock instanceof GT_Block_LongDistancePipe) {
byte aMetaData = gtTile.getMetaIDAtSide(gtTile.getBackFacing());
if (aMetaData != getPipeMeta()) return;
- HashSet<ChunkCoordinates>
- tVisited = new HashSet<>(Collections.singletonList(getCoords())),
- tWires = new HashSet<>();
- Queue<ChunkCoordinates>
- tQueue = new LinkedList<>(Collections.singletonList(getFacingOffset(gtTile, gtTile.getBackFacing())));
+ HashSet<ChunkCoordinates> tVisited = new HashSet<>(Collections.singletonList(getCoords())),
+ tWires = new HashSet<>();
+ Queue<ChunkCoordinates> tQueue =
+ new LinkedList<>(Collections.singletonList(getFacingOffset(gtTile, gtTile.getBackFacing())));
while (!tQueue.isEmpty()) {
final ChunkCoordinates aCoords = tQueue.poll();
- if(world.getBlock(aCoords.posX, aCoords.posY, aCoords.posZ) == aBlock && world.getBlockMetadata(aCoords.posX, aCoords.posY, aCoords.posZ) == aMetaData) {
+ if (world.getBlock(aCoords.posX, aCoords.posY, aCoords.posZ) == aBlock
+ && world.getBlockMetadata(aCoords.posX, aCoords.posY, aCoords.posZ) == aMetaData) {
// We've got another pipe/wire block
// TODO: Make sure it's the right type of pipe/wire via meta
ChunkCoordinates tCoords;
tWires.add(aCoords);
- // For each direction, if we haven't already visisted that coordinate, add it to the end of the queue
- if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX + 1, aCoords.posY, aCoords.posZ))) tQueue.add(tCoords);
- if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX - 1, aCoords.posY, aCoords.posZ))) tQueue.add(tCoords);
- if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY + 1, aCoords.posZ))) tQueue.add(tCoords);
- if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY - 1, aCoords.posZ))) tQueue.add(tCoords);
- if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY, aCoords.posZ + 1))) tQueue.add(tCoords);
- if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY, aCoords.posZ - 1))) tQueue.add(tCoords);
+ // For each direction, if we haven't already visisted that coordinate, add it to the end of the
+ // queue
+ if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX + 1, aCoords.posY, aCoords.posZ)))
+ tQueue.add(tCoords);
+ if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX - 1, aCoords.posY, aCoords.posZ)))
+ tQueue.add(tCoords);
+ if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY + 1, aCoords.posZ)))
+ tQueue.add(tCoords);
+ if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY - 1, aCoords.posZ)))
+ tQueue.add(tCoords);
+ if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY, aCoords.posZ + 1)))
+ tQueue.add(tCoords);
+ if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY, aCoords.posZ - 1)))
+ tQueue.add(tCoords);
} else {
// It's not a block - let's see if it's a tile entity
TileEntity tTileEntity = world.getTileEntity(aCoords.posX, aCoords.posY, aCoords.posZ);
- if (
- tTileEntity != gtTile && tTileEntity instanceof BaseMetaTileEntity &&
- ((BaseMetaTileEntity)tTileEntity).getMetaTileEntity() instanceof GT_MetaTileEntity_LongDistancePipelineBase)
- {
- final GT_MetaTileEntity_LongDistancePipelineBase tGtTile = (GT_MetaTileEntity_LongDistancePipelineBase)((BaseMetaTileEntity) tTileEntity).getMetaTileEntity();
- if (isSameClass(tGtTile) && tWires.contains(
- tGtTile.getFacingOffset((BaseMetaTileEntity)tTileEntity, ((BaseMetaTileEntity) tTileEntity).getFrontFacing())
- )) {
- // If it's the same class, and we've scanned a wire in front of it (the input side), we've found our target
+ if (tTileEntity != gtTile
+ && tTileEntity instanceof BaseMetaTileEntity
+ && ((BaseMetaTileEntity) tTileEntity).getMetaTileEntity()
+ instanceof GT_MetaTileEntity_LongDistancePipelineBase) {
+ final GT_MetaTileEntity_LongDistancePipelineBase tGtTile =
+ (GT_MetaTileEntity_LongDistancePipelineBase)
+ ((BaseMetaTileEntity) tTileEntity).getMetaTileEntity();
+ if (isSameClass(tGtTile)
+ && tWires.contains(tGtTile.getFacingOffset(
+ (BaseMetaTileEntity) tTileEntity,
+ ((BaseMetaTileEntity) tTileEntity).getFrontFacing()))) {
+ // If it's the same class, and we've scanned a wire in front of it (the input side), we've
+ // found our target
// still need to check if it's distant enough
int distance = getDistanceToSelf(aCoords);
if (distance > minimalDistancePoints) {
@@ -245,27 +256,25 @@ public abstract class GT_MetaTileEntity_LongDistancePipelineBase extends GT_Meta
}
}
- // Remove this block from the visited because we might end up back here from another wire that IS connected to the
+ // Remove this block from the visited because we might end up back here from another wire that
+ // IS connected to the
// input side
tVisited.remove(aCoords);
}
}
}
}
-
}
protected int getDistanceToSelf(ChunkCoordinates aCoords) {
- return Math.abs(getBaseMetaTileEntity().getXCoord() - aCoords.posX) +
- Math.abs(getBaseMetaTileEntity().getYCoord() - aCoords.posY) / 2 +
- Math.abs(getBaseMetaTileEntity().getZCoord() - aCoords.posZ);
+ return Math.abs(getBaseMetaTileEntity().getXCoord() - aCoords.posX)
+ + Math.abs(getBaseMetaTileEntity().getYCoord() - aCoords.posY) / 2
+ + Math.abs(getBaseMetaTileEntity().getZCoord() - aCoords.posZ);
}
public ChunkCoordinates getFacingOffset(IGregTechTileEntity gt_tile, byte aSide) {
return new ChunkCoordinates(
- gt_tile.getOffsetX(aSide, 1), gt_tile.getOffsetY(aSide, 1), gt_tile.getOffsetZ(aSide, 1)
- );
-
+ gt_tile.getOffsetX(aSide, 1), gt_tile.getOffsetY(aSide, 1), gt_tile.getOffsetZ(aSide, 1));
}
public ChunkCoordinates getCoords() {
@@ -275,8 +284,9 @@ public abstract class GT_MetaTileEntity_LongDistancePipelineBase extends GT_Meta
@Override
public void onMachineBlockUpdate() {
- //GT_Mod.GT_FML_LOGGER.info("You're dead to me");
- mTargetPos = null; mSender = null;
+ // GT_Mod.GT_FML_LOGGER.info("You're dead to me");
+ mTargetPos = null;
+ mSender = null;
}
@Override
@@ -285,42 +295,37 @@ public abstract class GT_MetaTileEntity_LongDistancePipelineBase extends GT_Meta
}
@Override
- public boolean shouldTriggerBlockUpdate() { return true; }
+ public boolean shouldTriggerBlockUpdate() {
+ return true;
+ }
@Override
- public void getWailaBody(ItemStack itemStack, List<String> currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
+ public void getWailaBody(
+ ItemStack itemStack, List<String> currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
final NBTTagCompound tag = accessor.getNBTData();
final int facing = getBaseMetaTileEntity().getFrontFacing();
final int side = (byte) accessor.getSide().ordinal();
- if (side == facing)
- currentTip.add(GOLD + "Pipeline Input" + RESET);
- else if (side == ForgeDirection.OPPOSITES[facing])
- currentTip.add(BLUE + "Pipeline Output" + RESET);
- else
- currentTip.add("Pipeline Side");
+ if (side == facing) currentTip.add(GOLD + "Pipeline Input" + RESET);
+ else if (side == ForgeDirection.OPPOSITES[facing]) currentTip.add(BLUE + "Pipeline Output" + RESET);
+ else currentTip.add("Pipeline Side");
- if (tag.getBoolean("hasSender"))
- currentTip.add("Other End of Input: " + GREEN + "distance" + RESET);
+ if (tag.getBoolean("hasSender")) currentTip.add("Other End of Input: " + GREEN + "distance" + RESET);
else if (tag.getBoolean("hasTooCloseSender"))
currentTip.add("Other End of Input: " + RED + "too close" + RESET);
- else
- currentTip.add("Other End of Input: " + YELLOW + "cannot found(may need to update other end)" + RESET);
+ else currentTip.add("Other End of Input: " + YELLOW + "cannot found(may need to update other end)" + RESET);
- if (tag.getBoolean("hasTarget"))
- currentTip.add("Other End of Output: " + GREEN + "distance" + RESET);
+ if (tag.getBoolean("hasTarget")) currentTip.add("Other End of Output: " + GREEN + "distance" + RESET);
else if (tag.getBoolean("hasTooCloseTarget"))
currentTip.add("Other End of Output: " + RED + "too close" + RESET);
- else
- currentTip.add("Other End of Output: " + YELLOW + "cannot found" + RESET);
+ else currentTip.add("Other End of Output: " + YELLOW + "cannot found" + RESET);
super.getWailaBody(itemStack, currentTip, accessor, config);
-
}
-
@Override
- public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, int z) {
+ public void getWailaNBTData(
+ EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, int z) {
super.getWailaNBTData(player, tile, tag, world, x, y, z);
tag.setBoolean("hasSender", mSender != null);
diff --git a/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineFluid.java b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineFluid.java
index fe0a8527ab..849ce40101 100644
--- a/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineFluid.java
+++ b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineFluid.java
@@ -19,9 +19,14 @@
* You should have received a copy of the GNU Lesser General Public License
* along with GregTech. If not, see <http://www.gnu.org/licenses/>.
*/
-
package gregtech.common.tileentities.machines.long_distance;
+import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_FLUID_BACK;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_FLUID_FRONT;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_FLUID_SIDE;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_FLUID_SIDE_GLOW;
+
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -33,12 +38,6 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
-import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS;
-import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_FLUID_BACK;
-import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_FLUID_FRONT;
-import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_FLUID_SIDE;
-import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_FLUID_SIDE_GLOW;
-
public class GT_MetaTileEntity_LongDistancePipelineFluid extends GT_MetaTileEntity_LongDistancePipelineBase {
static final FluidTankInfo[] emptyTank = {new FluidTankInfo(null, Integer.MAX_VALUE)};
@@ -46,7 +45,8 @@ public class GT_MetaTileEntity_LongDistancePipelineFluid extends GT_MetaTileEnti
super(aID, aName, aNameRegional, aTier, "Sends fluids over long distances");
}
- public GT_MetaTileEntity_LongDistancePipelineFluid(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_LongDistancePipelineFluid(
+ String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
super(aName, aTier, aDescription, aTextures);
}
@@ -63,7 +63,7 @@ public class GT_MetaTileEntity_LongDistancePipelineFluid extends GT_MetaTileEnti
public IFluidHandler getTank() {
final IGregTechTileEntity tTile = mTarget.getBaseMetaTileEntity();
TileEntity tankTile = tTile.getTileEntityAtSide(tTile.getBackFacing());
- if (tankTile instanceof IFluidHandler) return (IFluidHandler)tankTile;
+ if (tankTile instanceof IFluidHandler) return (IFluidHandler) tankTile;
else return null;
}
@@ -72,24 +72,27 @@ public class GT_MetaTileEntity_LongDistancePipelineFluid extends GT_MetaTileEnti
if (checkTarget()) {
final IFluidHandler tankTile = getTank();
if (tankTile != null) return tankTile.getTankInfo(aSide);
-
}
return emptyTank;
}
+
@Override
public int fill(ForgeDirection aSide, FluidStack aFluid, boolean aDoFill) {
if (checkTarget()) {
final IGregTechTileEntity tTile = mTarget.getBaseMetaTileEntity();
final IFluidHandler tankTile = getTank();
- if (tankTile != null) return tankTile.fill(ForgeDirection.getOrientation(tTile.getFrontFacing()), aFluid, aDoFill);
+ if (tankTile != null)
+ return tankTile.fill(ForgeDirection.getOrientation(tTile.getFrontFacing()), aFluid, aDoFill);
}
return 0;
}
+
@Override
public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean aDoDrain) {
return null;
}
+
@Override
public FluidStack drain(ForgeDirection aSide, int aMaxDrain, boolean aDoDrain) {
return null;
@@ -99,25 +102,36 @@ public class GT_MetaTileEntity_LongDistancePipelineFluid extends GT_MetaTileEnti
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MetaTileEntity_LongDistancePipelineFluid(mName, mTier, getDescription()[0], mTextures);
}
+
@Override
public ITexture[][][] getTextureSet(ITexture[] aTextures) {
return new ITexture[0][0][0];
}
@Override
- public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ public ITexture[] getTexture(
+ IGregTechTileEntity aBaseMetaTileEntity,
+ byte aSide,
+ byte aFacing,
+ byte aColorIndex,
+ boolean aActive,
+ boolean aRedstone) {
if (aSide == aFacing)
- return new ITexture[]{
- MACHINE_CASINGS[mTier][aColorIndex + 1],
- TextureFactory.of(OVERLAY_PIPELINE_FLUID_FRONT)};
+ return new ITexture[] {
+ MACHINE_CASINGS[mTier][aColorIndex + 1], TextureFactory.of(OVERLAY_PIPELINE_FLUID_FRONT)
+ };
else if (aSide == GT_Utility.getOppositeSide(aFacing))
- return new ITexture[]{
- MACHINE_CASINGS[mTier][aColorIndex + 1],
- TextureFactory.of(OVERLAY_PIPELINE_FLUID_BACK)};
+ return new ITexture[] {
+ MACHINE_CASINGS[mTier][aColorIndex + 1], TextureFactory.of(OVERLAY_PIPELINE_FLUID_BACK)
+ };
else
- return new ITexture[]{
- MACHINE_CASINGS[mTier][aColorIndex + 1],
- TextureFactory.of(OVERLAY_PIPELINE_FLUID_SIDE),
- TextureFactory.builder().addIcon(OVERLAY_PIPELINE_FLUID_SIDE_GLOW).glow().build()};
+ return new ITexture[] {
+ MACHINE_CASINGS[mTier][aColorIndex + 1],
+ TextureFactory.of(OVERLAY_PIPELINE_FLUID_SIDE),
+ TextureFactory.builder()
+ .addIcon(OVERLAY_PIPELINE_FLUID_SIDE_GLOW)
+ .glow()
+ .build()
+ };
}
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineItem.java b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineItem.java
index b6b3636ab0..0559290df6 100644
--- a/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineItem.java
+++ b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineItem.java
@@ -19,9 +19,14 @@
* You should have received a copy of the GNU Lesser General Public License
* along with GregTech. If not, see <http://www.gnu.org/licenses/>.
*/
-
package gregtech.common.tileentities.machines.long_distance;
+import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_ITEM_BACK;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_ITEM_FRONT;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_ITEM_SIDE;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_ITEM_SIDE_GLOW;
+
import gregtech.api.enums.GT_Values;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
@@ -33,18 +38,13 @@ import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS;
-import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_ITEM_BACK;
-import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_ITEM_FRONT;
-import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_ITEM_SIDE;
-import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_ITEM_SIDE_GLOW;
-
public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntity_LongDistancePipelineBase {
public GT_MetaTileEntity_LongDistancePipelineItem(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier, "Sends Items over long distances");
}
- public GT_MetaTileEntity_LongDistancePipelineItem(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_LongDistancePipelineItem(
+ String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
super(aName, aTier, aDescription, aTextures);
}
@@ -61,7 +61,7 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit
public IInventory getInventory() {
final IGregTechTileEntity tTile = mTarget.getBaseMetaTileEntity();
TileEntity invTile = tTile.getTileEntityAtSide(tTile.getBackFacing());
- if (invTile instanceof IInventory) return (IInventory)invTile;
+ if (invTile instanceof IInventory) return (IInventory) invTile;
else return null;
}
@@ -73,6 +73,7 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit
}
return null;
}
+
@Override
public ItemStack getStackInSlotOnClosing(int aSlot) {
if (checkTarget()) {
@@ -81,6 +82,7 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit
}
return null;
}
+
@Override
public ItemStack getStackInSlot(int aSlot) {
if (checkTarget()) {
@@ -89,6 +91,7 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit
}
return null;
}
+
@Override
public String getInventoryName() {
if (checkTarget()) {
@@ -97,6 +100,7 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit
}
return super.getInventoryName();
}
+
@Override
public int getSizeInventory() {
if (checkTarget()) {
@@ -105,6 +109,7 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit
}
return 0;
}
+
@Override
public int getInventoryStackLimit() {
if (checkTarget()) {
@@ -113,6 +118,7 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit
}
return 0;
}
+
@Override
public void setInventorySlotContents(int aSlot, ItemStack aStack) {
if (checkTarget()) {
@@ -120,6 +126,7 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit
if (iInventory != null) iInventory.setInventorySlotContents(aSlot, aStack);
}
}
+
@Override
public boolean hasCustomInventoryName() {
if (checkTarget()) {
@@ -128,6 +135,7 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit
}
return false;
}
+
@Override
public boolean isItemValidForSlot(int aSlot, ItemStack aStack) {
if (checkTarget()) {
@@ -137,15 +145,16 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit
return false;
}
-// // Relay Sided Inventories
-//
+ // // Relay Sided Inventories
+ //
@Override
public int[] getAccessibleSlotsFromSide(int aSide) {
if (checkTarget()) {
final IGregTechTileEntity tTile = mTarget.getBaseMetaTileEntity();
final IInventory iInventory = getInventory();
- if (iInventory instanceof ISidedInventory) return ((ISidedInventory)iInventory).getAccessibleSlotsFromSide(tTile.getFrontFacing());
+ if (iInventory instanceof ISidedInventory)
+ return ((ISidedInventory) iInventory).getAccessibleSlotsFromSide(tTile.getFrontFacing());
if (iInventory != null) {
final int[] tReturn = new int[iInventory.getSizeInventory()];
for (int i = 0; i < tReturn.length; i++) tReturn[i] = i;
@@ -161,7 +170,8 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit
if (checkTarget()) {
final IGregTechTileEntity tTile = mTarget.getBaseMetaTileEntity();
IInventory iInventory = getInventory();
- if (iInventory instanceof ISidedInventory) return ((ISidedInventory)iInventory).canInsertItem(aSlot, aStack, tTile.getFrontFacing());
+ if (iInventory instanceof ISidedInventory)
+ return ((ISidedInventory) iInventory).canInsertItem(aSlot, aStack, tTile.getFrontFacing());
return iInventory != null;
}
return false;
@@ -176,20 +186,31 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MetaTileEntity_LongDistancePipelineItem(mName, mTier, getDescription()[0], mTextures);
}
+
@Override
- public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ public ITexture[] getTexture(
+ IGregTechTileEntity aBaseMetaTileEntity,
+ byte aSide,
+ byte aFacing,
+ byte aColorIndex,
+ boolean aActive,
+ boolean aRedstone) {
if (aSide == aFacing)
- return new ITexture[]{
- MACHINE_CASINGS[mTier][aColorIndex + 1],
- TextureFactory.of(OVERLAY_PIPELINE_ITEM_FRONT)};
+ return new ITexture[] {
+ MACHINE_CASINGS[mTier][aColorIndex + 1], TextureFactory.of(OVERLAY_PIPELINE_ITEM_FRONT)
+ };
else if (aSide == GT_Utility.getOppositeSide(aFacing))
- return new ITexture[]{
- MACHINE_CASINGS[mTier][aColorIndex + 1],
- TextureFactory.of(OVERLAY_PIPELINE_ITEM_BACK)};
+ return new ITexture[] {
+ MACHINE_CASINGS[mTier][aColorIndex + 1], TextureFactory.of(OVERLAY_PIPELINE_ITEM_BACK)
+ };
else
- return new ITexture[]{
- MACHINE_CASINGS[mTier][aColorIndex + 1],
- TextureFactory.of(OVERLAY_PIPELINE_ITEM_SIDE),
- TextureFactory.builder().addIcon(OVERLAY_PIPELINE_ITEM_SIDE_GLOW).glow().build()};
+ return new ITexture[] {
+ MACHINE_CASINGS[mTier][aColorIndex + 1],
+ TextureFactory.of(OVERLAY_PIPELINE_ITEM_SIDE),
+ TextureFactory.builder()
+ .addIcon(OVERLAY_PIPELINE_ITEM_SIDE_GLOW)
+ .glow()
+ .build()
+ };
}
}