aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/metatileentity
diff options
context:
space:
mode:
authorJason Mitchell <mitchej@gmail.com>2023-01-30 10:56:42 -0800
committerJason Mitchell <mitchej@gmail.com>2023-01-30 10:56:42 -0800
commit0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a (patch)
tree1e2c649f3a6ce3f6b2babd0098a5f4819e9cd0b6 /src/main/java/gregtech/api/metatileentity
parentf8cc82edeb9810c45cba762d733a2c909a302faa (diff)
downloadGT5-Unofficial-0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a.tar.gz
GT5-Unofficial-0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a.tar.bz2
GT5-Unofficial-0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a.zip
[ci skip] spotlessApply with the new settings
Diffstat (limited to 'src/main/java/gregtech/api/metatileentity')
-rw-r--r--src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java336
-rw-r--r--src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java746
-rw-r--r--src/main/java/gregtech/api/metatileentity/BaseTileEntity.java319
-rw-r--r--src/main/java/gregtech/api/metatileentity/CommonMetaTileEntity.java15
-rw-r--r--src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java272
-rw-r--r--src/main/java/gregtech/api/metatileentity/GregTechTileClientEvents.java1
-rw-r--r--src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java293
-rw-r--r--src/main/java/gregtech/api/metatileentity/MetaTileEntity.java236
-rw-r--r--src/main/java/gregtech/api/metatileentity/TileIC2EnergySink.java55
-rw-r--r--src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java61
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java371
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java343
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java43
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java305
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java220
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java91
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicHull.java58
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicHull_NonElectric.java22
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java641
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java254
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java418
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Steel.java151
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java120
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java258
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java81
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java225
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ExtendedPowerMultiBlockBase.java93
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java80
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DataAccess.java28
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Dynamo.java24
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy.java41
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java53
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java44
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java178
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java62
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_MultiInput.java71
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java182
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java52
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java493
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SpecialFilter.java144
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java54
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TooltipMultiBlockBase.java11
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java253
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Wireless_Dynamo.java27
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Wireless_Hatch.java30
45 files changed, 3614 insertions, 4241 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
index 31a341040e..335639c9e3 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
@@ -3,6 +3,24 @@ package gregtech.api.metatileentity;
import static gregtech.GT_Mod.GT_FML_LOGGER;
import static gregtech.api.enums.GT_Values.NW;
+import java.util.*;
+
+import net.minecraft.block.Block;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidHandler;
+
import gregtech.api.GregTech_API;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.SoundResource;
@@ -23,22 +41,6 @@ import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
import gregtech.common.covers.CoverInfo;
-import java.util.*;
-import net.minecraft.block.Block;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Items;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.world.World;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.Fluid;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.fluids.FluidTankInfo;
-import net.minecraftforge.fluids.IFluidHandler;
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
@@ -47,16 +49,12 @@ import net.minecraftforge.fluids.IFluidHandler;
*/
public class BaseMetaPipeEntity extends CommonMetaTileEntity
implements IGregTechTileEntity, IPipeRenderedTileEntity, IDebugableTileEntity {
+
public byte mConnections = IConnectable.NO_CONNECTION;
protected MetaPipeEntity mMetaTileEntity;
private final int[] mTimeStatistics = new int[GregTech_API.TICKS_FOR_LAG_AVERAGING];
private boolean mWorkUpdate = false, mWorks = true;
- private byte mColor = 0,
- oColor = 0,
- oStrongRedstone = 0,
- oRedstoneData = 63,
- oTextureData = 0,
- oUpdateData = 0,
+ private byte mColor = 0, oColor = 0, oStrongRedstone = 0, oRedstoneData = 63, oTextureData = 0, oUpdateData = 0,
mLagWarningCount = 0;
private int oX = 0, oY = 0, oZ = 0, mTimeStatisticsIndex = 0;
protected Node node;
@@ -147,7 +145,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
mColor = aNBT.getByte("mColor");
mWorks = !aNBT.getBoolean("mWorks");
- if (mSidedRedstone.length != 6) mSidedRedstone = new byte[] {0, 0, 0, 0, 0, 0};
+ if (mSidedRedstone.length != 6) mSidedRedstone = new byte[] { 0, 0, 0, 0, 0, 0 };
readCoverNBT(aNBT);
loadMetaTileNBT(aNBT);
@@ -199,8 +197,8 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
// 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);
+ mConnections = (byte) ((mConnections & ~IConnectable.HAS_FRESHFOAM)
+ | IConnectable.HAS_HARDENEDFOAM);
}
if (mTickTimer > 12 && oldConnections != mConnections)
GregTech_API.causeCableUpdate(worldObj, xCoord, yCoord, zCoord);
@@ -236,8 +234,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
byte tData = mMetaTileEntity.getUpdateData();
if (tData != oUpdateData) sendBlockEvent((byte) 1, oUpdateData = tData);
if (mColor != oColor) sendBlockEvent((byte) 2, oColor = mColor);
- tData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0)
- | ((mSidedRedstone[1] > 0) ? 2 : 0)
+ tData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0)
| ((mSidedRedstone[2] > 0) ? 4 : 0)
| ((mSidedRedstone[3] > 0) ? 8 : 0)
| ((mSidedRedstone[4] > 0) ? 16 : 0)
@@ -259,17 +256,24 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
if (isServerSide() && hasValidMetaTileEntity()) {
tTime = System.nanoTime() - tTime;
- if (mTimeStatistics.length > 0)
- mTimeStatistics[mTimeStatisticsIndex = (mTimeStatisticsIndex + 1) % mTimeStatistics.length] =
- (int) tTime;
- if (tTime > 0
- && tTime > (GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING * 1000000L)
+ if (mTimeStatistics.length > 0) mTimeStatistics[mTimeStatisticsIndex = (mTimeStatisticsIndex + 1)
+ % mTimeStatistics.length] = (int) tTime;
+ if (tTime > 0 && tTime > (GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING * 1000000L)
&& mTickTimer > 1000
&& getMetaTileEntity().doTickProfilingMessageDuringThisTick()
&& mLagWarningCount++ < 10)
- GT_FML_LOGGER.warn("WARNING: Possible Lag Source at [" + xCoord + "," + yCoord + "," + zCoord
- + "] in Dimension " + worldObj.provider.dimensionId + " with " + tTime
- + " ns caused by an instance of " + getMetaTileEntity().getClass());
+ GT_FML_LOGGER.warn(
+ "WARNING: Possible Lag Source at [" + xCoord
+ + ","
+ + yCoord
+ + ","
+ + zCoord
+ + "] in Dimension "
+ + worldObj.provider.dimensionId
+ + " with "
+ + tTime
+ + " ns caused by an instance of "
+ + getMetaTileEntity().getClass());
}
mWorkUpdate = mInventoryChanged = false;
@@ -306,18 +310,8 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
sendCoverDataIfNeeded();
}
- public final void receiveMetaTileEntityData(
- short aID,
- int aCover0,
- int aCover1,
- int aCover2,
- int aCover3,
- int aCover4,
- int aCover5,
- byte aTextureData,
- byte aUpdateData,
- byte aRedstoneData,
- byte aColorData) {
+ public final void receiveMetaTileEntityData(short aID, int aCover0, int aCover1, int aCover2, int aCover3,
+ int aCover4, int aCover5, byte aTextureData, byte aUpdateData, byte aRedstoneData, byte aColorData) {
issueTextureUpdate();
if (aID > 0 && mID != aID) {
mID = aID;
@@ -391,13 +385,15 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
public ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aLogLevel) {
final ArrayList<String> tList = new ArrayList<>();
if (aLogLevel > 3) {
- tList.add("Meta-ID: " + EnumChatFormatting.BLUE + mID + EnumChatFormatting.RESET
- + (hasValidMetaTileEntity()
- ? EnumChatFormatting.GREEN + " valid" + EnumChatFormatting.RESET
- : EnumChatFormatting.RED + " invalid" + EnumChatFormatting.RESET)
- + (mMetaTileEntity == null
- ? EnumChatFormatting.RED + " MetaTileEntity == null!" + EnumChatFormatting.RESET
- : " "));
+ tList.add(
+ "Meta-ID: " + EnumChatFormatting.BLUE
+ + mID
+ + EnumChatFormatting.RESET
+ + (hasValidMetaTileEntity() ? EnumChatFormatting.GREEN + " valid" + EnumChatFormatting.RESET
+ : EnumChatFormatting.RED + " invalid" + EnumChatFormatting.RESET)
+ + (mMetaTileEntity == null
+ ? EnumChatFormatting.RED + " MetaTileEntity == null!" + EnumChatFormatting.RESET
+ : " "));
}
if (aLogLevel > 1) {
if (mTimeStatistics.length > 0) {
@@ -409,26 +405,30 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
tWorstTime = tTime;
}
}
- tList.add("Average CPU-load of ~" + (tAverageTime / mTimeStatistics.length) + "ns since "
- + mTimeStatistics.length + " ticks with worst time of " + tWorstTime + "ns.");
+ tList.add(
+ "Average CPU-load of ~" + (tAverageTime / mTimeStatistics.length)
+ + "ns since "
+ + mTimeStatistics.length
+ + " ticks with worst time of "
+ + tWorstTime
+ + "ns.");
}
if (mLagWarningCount > 0) {
- tList.add("Caused " + (mLagWarningCount >= 10 ? "more than 10" : mLagWarningCount)
- + " Lag Spike Warnings (anything taking longer than "
- + GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING + "ms) on the Server.");
+ tList.add(
+ "Caused " + (mLagWarningCount >= 10 ? "more than 10" : mLagWarningCount)
+ + " Lag Spike Warnings (anything taking longer than "
+ + GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING
+ + "ms) on the Server.");
}
if (mMetaTileEntity != null) {
- tList.add("Is"
- + (mMetaTileEntity.isAccessAllowed(aPlayer)
- ? " "
- : EnumChatFormatting.RED + " not " + EnumChatFormatting.RESET)
- + "accessible for you");
+ tList.add(
+ "Is" + (mMetaTileEntity.isAccessAllowed(aPlayer) ? " "
+ : EnumChatFormatting.RED + " not " + EnumChatFormatting.RESET) + "accessible for you");
}
}
if (joinedIc2Enet) tList.add("Joined IC2 ENet");
- return mMetaTileEntity != null
- ? mMetaTileEntity.getSpecialDebugInfo(this, aPlayer, aLogLevel, tList)
+ return mMetaTileEntity != null ? mMetaTileEntity.getSpecialDebugInfo(this, aPlayer, aLogLevel, tList)
: new ArrayList<>();
}
@@ -469,9 +469,9 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
public void setInventorySlotContents(int aIndex, ItemStack aStack) {
markDirty();
mInventoryChanged = true;
- if (canAccessData())
- mMetaTileEntity.setInventorySlotContents(
- aIndex, worldObj.isRemote ? aStack : GT_OreDictUnificator.setStack(true, aStack));
+ if (canAccessData()) mMetaTileEntity.setInventorySlotContents(
+ aIndex,
+ worldObj.isRemote ? aStack : GT_OreDictUnificator.setStack(true, aStack));
}
@Override
@@ -489,18 +489,17 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
@Override
public void openInventory() {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public void closeInventory() {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public boolean isUseableByPlayer(EntityPlayer aPlayer) {
- return hasValidMetaTileEntity()
- && mTickTimer > 40
+ return hasValidMetaTileEntity() && mTickTimer > 40
&& getTileEntityOffset(0, 0, 0) == this
&& aPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64
&& mMetaTileEntity.isAccessAllowed(aPlayer);
@@ -606,7 +605,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
@Override
public void setWorkDataValue(byte aValue) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
@@ -626,7 +625,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
@Override
public void setActive(boolean aActive) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
@@ -707,7 +706,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
@Override
public ITexture[] getTexture(Block aBlock, byte aSide) {
final ITexture rIcon = getCoverTexture(aSide);
- if (rIcon != null) return new ITexture[] {rIcon};
+ if (rIcon != null) return new ITexture[] { rIcon };
return getTextureUncovered(aSide);
}
@@ -737,14 +736,13 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
tConnections = (byte) (IConnectable.CONNECTED_DOWN | IConnectable.CONNECTED_UP);
else if (tConnections == IConnectable.CONNECTED_NORTH || tConnections == IConnectable.CONNECTED_SOUTH)
tConnections = (byte) (IConnectable.CONNECTED_NORTH | IConnectable.CONNECTED_SOUTH);
- if (hasValidMetaTileEntity())
- return mMetaTileEntity.getTexture(
- this,
- aSide,
- tConnections,
- (byte) (mColor - 1),
- tConnections == 0 || (tConnections & (1 << aSide)) != 0,
- getOutputRedstoneSignal(aSide) > 0);
+ if (hasValidMetaTileEntity()) return mMetaTileEntity.getTexture(
+ this,
+ aSide,
+ tConnections,
+ (byte) (mColor - 1),
+ tConnections == 0 || (tConnections & (1 << aSide)) != 0,
+ getOutputRedstoneSignal(aSide) > 0);
return Textures.BlockIcons.ERROR_RENDERING;
}
@@ -785,8 +783,8 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
if (isClientSide()) {
// Configure Cover, sneak can also be: screwdriver, wrench, side cutter, soldering iron
if (aPlayer.isSneaking()) {
- final byte tSide =
- (getCoverIDAtSide(aSide) == 0) ? GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ) : aSide;
+ final byte tSide = (getCoverIDAtSide(aSide) == 0) ? GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ)
+ : aSide;
return (getCoverInfoAtSide(tSide).hasCoverGUI());
} else if (getCoverBehaviorAtSideNew(aSide).onCoverRightclickClient(aSide, this, aPlayer, aX, aY, aZ)) {
return true;
@@ -808,7 +806,13 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
mMetaTileEntity.markDirty();
GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer);
GT_Utility.sendSoundToPlayers(
- worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord);
+ worldObj,
+ SoundResource.IC2_TOOLS_WRENCH,
+ 1.0F,
+ -1,
+ xCoord,
+ yCoord,
+ zCoord);
}
return true;
}
@@ -821,16 +825,29 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
mMetaTileEntity.onScrewdriverRightClick(tSide, aPlayer, aX, aY, aZ);
mMetaTileEntity.markDirty();
GT_Utility.sendSoundToPlayers(
- worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord);
+ worldObj,
+ SoundResource.IC2_TOOLS_WRENCH,
+ 1.0F,
+ -1,
+ xCoord,
+ yCoord,
+ zCoord);
}
} else {
if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) {
setCoverDataAtSide(
- aSide, getCoverInfoAtSide(aSide).onCoverScrewdriverClick(aPlayer, aX, aY, aZ));
+ aSide,
+ getCoverInfoAtSide(aSide).onCoverScrewdriverClick(aPlayer, aX, aY, aZ));
mMetaTileEntity.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
mMetaTileEntity.markDirty();
GT_Utility.sendSoundToPlayers(
- worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord);
+ worldObj,
+ SoundResource.IC2_TOOLS_WRENCH,
+ 1.0F,
+ -1,
+ xCoord,
+ yCoord,
+ zCoord);
}
}
return true;
@@ -838,7 +855,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sHardHammerList)) {
// if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) {
- // GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(1), 1.0F, -1, xCoord, yCoord,
+ // GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(1), 1.0F, -1, xCoord, yCoord,
// zCoord);
// }
return true;
@@ -852,11 +869,16 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
GT_Utility.sendChatToPlayer(
aPlayer,
GT_Utility.trans("090", "Machine Processing: ")
- + (isAllowedToWork()
- ? GT_Utility.trans("088", "Enabled")
+ + (isAllowedToWork() ? GT_Utility.trans("088", "Enabled")
: GT_Utility.trans("087", "Disabled")));
GT_Utility.sendSoundToPlayers(
- worldObj, SoundResource.IC2_TOOLS_RUBBER_TRAMPOLINE, 1.0F, -1, xCoord, yCoord, zCoord);
+ worldObj,
+ SoundResource.IC2_TOOLS_RUBBER_TRAMPOLINE,
+ 1.0F,
+ -1,
+ xCoord,
+ yCoord,
+ zCoord);
}
return true;
}
@@ -866,7 +888,13 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
mMetaTileEntity.markDirty();
// logic handled internally
GT_Utility.sendSoundToPlayers(
- worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord);
+ worldObj,
+ SoundResource.IC2_TOOLS_WRENCH,
+ 1.0F,
+ -1,
+ xCoord,
+ yCoord,
+ zCoord);
}
doEnetUpdate();
return true;
@@ -877,20 +905,30 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
mMetaTileEntity.markDirty();
// logic handled internally
GT_Utility.sendSoundToPlayers(
- worldObj, SoundResource.IC2_TOOLS_BATTERY_USE, 1.0F, -1, xCoord, yCoord, zCoord);
+ worldObj,
+ SoundResource.IC2_TOOLS_BATTERY_USE,
+ 1.0F,
+ -1,
+ xCoord,
+ yCoord,
+ zCoord);
} else if (GT_ModHandler.useSolderingIron(tCurrentItem, aPlayer)) {
mMetaTileEntity.markDirty();
mStrongRedstone ^= (1 << tSide);
GT_Utility.sendChatToPlayer(
aPlayer,
- GT_Utility.trans("091", "Redstone Output at Side ")
- + tSide
+ GT_Utility.trans("091", "Redstone Output at Side ") + tSide
+ GT_Utility.trans("092", " set to: ")
- + ((mStrongRedstone & (1 << tSide)) != 0
- ? GT_Utility.trans("093", "Strong")
+ + ((mStrongRedstone & (1 << tSide)) != 0 ? GT_Utility.trans("093", "Strong")
: GT_Utility.trans("094", "Weak")));
GT_Utility.sendSoundToPlayers(
- worldObj, SoundResource.IC2_TOOLS_BATTERY_USE, 3.0F, -1, xCoord, yCoord, zCoord);
+ worldObj,
+ SoundResource.IC2_TOOLS_BATTERY_USE,
+ 3.0F,
+ -1,
+ xCoord,
+ yCoord,
+ zCoord);
issueBlockUpdate();
}
doEnetUpdate();
@@ -905,13 +943,19 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
if (coverInfo.getCoverID() == 0) {
if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCovers.keySet())) {
if (GregTech_API.getCoverBehaviorNew(tCurrentItem)
- .isCoverPlaceable(coverSide, tCurrentItem, this)
+ .isCoverPlaceable(coverSide, tCurrentItem, this)
&& mMetaTileEntity.allowCoverOnSide(coverSide, new GT_ItemStack(tCurrentItem))) {
setCoverItemAtSide(coverSide, tCurrentItem);
mMetaTileEntity.markDirty();
if (!aPlayer.capabilities.isCreativeMode) tCurrentItem.stackSize--;
GT_Utility.sendSoundToPlayers(
- worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord);
+ worldObj,
+ SoundResource.IC2_TOOLS_WRENCH,
+ 1.0F,
+ -1,
+ xCoord,
+ yCoord,
+ zCoord);
}
return true;
}
@@ -919,7 +963,13 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCrowbarList)) {
if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) {
GT_Utility.sendSoundToPlayers(
- worldObj, SoundResource.RANDOM_BREAK, 1.0F, -1, xCoord, yCoord, zCoord);
+ worldObj,
+ SoundResource.RANDOM_BREAK,
+ 1.0F,
+ -1,
+ xCoord,
+ yCoord,
+ zCoord);
dropCover(coverSide, aSide, false);
mMetaTileEntity.markDirty();
}
@@ -990,8 +1040,8 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
}
/**
- * returns all valid Inventory Slots, no matter which Side (Unless it's covered).
- * The Side Stuff is done in the following two Functions.
+ * returns all valid Inventory Slots, no matter which Side (Unless it's covered). The Side Stuff is done in the
+ * following two Functions.
*/
@Override
public int[] getAccessibleSlotsFromSide(int aSide) {
@@ -1006,8 +1056,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
*/
@Override
public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) {
- return canAccessData()
- && getCoverInfoAtSide((byte) aSide).letsItemsIn(aIndex)
+ return canAccessData() && getCoverInfoAtSide((byte) aSide).letsItemsIn(aIndex)
&& mMetaTileEntity.canInsertItem(aIndex, aStack, aSide);
}
@@ -1016,15 +1065,12 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
*/
@Override
public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) {
- return canAccessData()
- && getCoverBehaviorAtSideNew((byte) aSide)
- .letsItemsOut(
- (byte) aSide,
- getCoverIDAtSide((byte) aSide),
- getComplexCoverDataAtSide((byte) aSide),
- aIndex,
- this)
- && mMetaTileEntity.canExtractItem(aIndex, aStack, aSide);
+ return canAccessData() && getCoverBehaviorAtSideNew((byte) aSide).letsItemsOut(
+ (byte) aSide,
+ getCoverIDAtSide((byte) aSide),
+ getComplexCoverDataAtSide((byte) aSide),
+ aIndex,
+ this) && mMetaTileEntity.canExtractItem(aIndex, aStack, aSide);
}
@Override
@@ -1154,21 +1200,20 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
// the pipe
if (tTileEntity != null && !mMetaTileEntity.isConnectedAtSide((byte) aSide.ordinal())) return false;
- if (isFill
- && mMetaTileEntity.isLiquidInput((byte) aSide.ordinal())
- && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidIn(aFluid)) return true;
+ if (isFill && mMetaTileEntity.isLiquidInput((byte) aSide.ordinal())
+ && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidIn(aFluid))
+ return true;
- if (!isFill
- && mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal())
- && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidOut(aFluid)) return true;
+ if (!isFill && mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal())
+ && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidOut(aFluid))
+ return true;
return false;
}
@Override
public int fill(ForgeDirection aSide, FluidStack aFluidStack, boolean doFill) {
- if (mTickTimer > 5
- && canAccessData()
+ if (mTickTimer > 5 && canAccessData()
&& canMoveFluidOnSide(aSide, aFluidStack == null ? null : aFluidStack.getFluid(), true))
return mMetaTileEntity.fill(aSide, aFluidStack, doFill);
return 0;
@@ -1176,21 +1221,18 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
@Override
public FluidStack drain(ForgeDirection aSide, int maxDrain, boolean doDrain) {
- if (mTickTimer > 5
- && canAccessData()
+ if (mTickTimer > 5 && canAccessData()
&& canMoveFluidOnSide(
aSide,
- mMetaTileEntity.getFluid() == null
- ? null
- : mMetaTileEntity.getFluid().getFluid(),
- false)) return mMetaTileEntity.drain(aSide, maxDrain, doDrain);
+ mMetaTileEntity.getFluid() == null ? null : mMetaTileEntity.getFluid().getFluid(),
+ false))
+ return mMetaTileEntity.drain(aSide, maxDrain, doDrain);
return null;
}
@Override
public FluidStack drain(ForgeDirection aSide, FluidStack aFluidStack, boolean doDrain) {
- if (mTickTimer > 5
- && canAccessData()
+ if (mTickTimer > 5 && canAccessData()
&& canMoveFluidOnSide(aSide, aFluidStack == null ? null : aFluidStack.getFluid(), false))
return mMetaTileEntity.drain(aSide, aFluidStack, doDrain);
return null;
@@ -1213,12 +1255,11 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection aSide) {
final CoverInfo coverInfo = getCoverInfoAtSide((byte) aSide.ordinal());
- if (canAccessData()
- && (aSide == ForgeDirection.UNKNOWN
- || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) && coverInfo.letsFluidIn(null))
- || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) && coverInfo.letsFluidOut(null))
- // Doesn't need to be connected to get Tank Info -- otherwise things can't connect
- )) return mMetaTileEntity.getTankInfo(aSide);
+ if (canAccessData() && (aSide == ForgeDirection.UNKNOWN
+ || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) && coverInfo.letsFluidIn(null))
+ || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) && coverInfo.letsFluidOut(null))
+ // Doesn't need to be connected to get Tank Info -- otherwise things can't connect
+ )) return mMetaTileEntity.getTankInfo(aSide);
return new FluidTankInfo[] {};
}
@@ -1232,9 +1273,8 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
return true;
}
aStack = GT_OreDictUnificator.get(aStack);
- if (GT_Utility.areStacksEqual(tStack, aStack)
- && tStack.stackSize + aStack.stackSize
- <= Math.min(aStack.getMaxStackSize(), getInventoryStackLimit())) {
+ if (GT_Utility.areStacksEqual(tStack, aStack) && tStack.stackSize + aStack.stackSize
+ <= Math.min(aStack.getMaxStackSize(), getInventoryStackLimit())) {
markDirty();
tStack.stackSize += aStack.stackSize;
return true;
@@ -1321,7 +1361,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
// Trigger a checking of connections in case someone placed down a block that the pipe/wire shouldn't be
// connected to.
// However; don't do it immediately in case the world isn't finished loading
- // (This caused issues with AE2 GTEU p2p connections.
+ // (This caused issues with AE2 GTEU p2p connections.
((MetaPipeEntity) meta).setCheckConnections();
}
}
@@ -1333,14 +1373,8 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
}
@Override
- public void addCollisionBoxesToList(
- World aWorld,
- int aX,
- int aY,
- int aZ,
- AxisAlignedBB inputAABB,
- List<AxisAlignedBB> outputAABB,
- Entity collider) {
+ public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB,
+ List<AxisAlignedBB> outputAABB, Entity collider) {
mMetaTileEntity.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider);
}
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
index 1e8ffa0994..7408701f16 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
@@ -6,6 +6,35 @@ import static gregtech.api.enums.GT_Values.NW;
import static gregtech.api.enums.GT_Values.V;
import static gregtech.api.objects.XSTR.XSTR_INSTANCE;
+import java.lang.reflect.Field;
+import java.util.*;
+
+import javax.annotation.Nullable;
+
+import mcp.mobius.waila.api.IWailaConfigHandler;
+import mcp.mobius.waila.api.IWailaDataAccessor;
+
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockFire;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.EnumSkyBlock;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+
import appeng.api.networking.IGridNode;
import appeng.api.networking.security.IActionHost;
import appeng.api.util.AECableType;
@@ -14,10 +43,12 @@ import appeng.me.helpers.AENetworkProxy;
import appeng.me.helpers.IGridProxyable;
import appeng.tile.TileEvent;
import appeng.tile.events.TileEventType;
+
import com.gtnewhorizon.structurelib.alignment.IAlignment;
import com.gtnewhorizon.structurelib.alignment.IAlignmentProvider;
import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable;
import com.gtnewhorizon.structurelib.alignment.constructable.IConstructableProvider;
+
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.ReflectionHelper;
import gregtech.GT_Mod;
@@ -43,31 +74,6 @@ import gregtech.api.util.*;
import gregtech.common.GT_Pollution;
import gregtech.common.covers.CoverInfo;
import ic2.api.Direction;
-import java.lang.reflect.Field;
-import java.util.*;
-import javax.annotation.Nullable;
-import mcp.mobius.waila.api.IWailaConfigHandler;
-import mcp.mobius.waila.api.IWailaDataAccessor;
-import net.minecraft.block.Block;
-import net.minecraft.block.BlockFire;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.item.EntityItem;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.init.Items;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.server.MinecraftServer;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.world.EnumSkyBlock;
-import net.minecraft.world.World;
-import net.minecraft.world.biome.BiomeGenBase;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.Fluid;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.fluids.FluidTankInfo;
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
@@ -76,27 +82,21 @@ import net.minecraftforge.fluids.FluidTankInfo;
*/
@Optional.InterfaceList(
value = {
- @Optional.Interface(
- iface = "appeng.api.networking.security.IActionHost",
- modid = "appliedenergistics2",
- striprefs = true),
- @Optional.Interface(
- iface = "appeng.me.helpers.IGridProxyable",
- modid = "appliedenergistics2",
- striprefs = true)
- })
-public class BaseMetaTileEntity extends CommonMetaTileEntity
- implements IGregTechTileEntity,
- IActionHost,
- IGridProxyable,
- IAlignmentProvider,
- IConstructableProvider,
- IDebugableTileEntity,
- IGregtechWailaProvider {
- private static final Field ENTITY_ITEM_HEALTH_FIELD =
- ReflectionHelper.findField(EntityItem.class, "health", "field_70291_e");
- private final boolean[] mActiveEUInputs = new boolean[] {false, false, false, false, false, false};
- private final boolean[] mActiveEUOutputs = new boolean[] {false, false, false, false, false, false};
+ @Optional.Interface(
+ iface = "appeng.api.networking.security.IActionHost",
+ modid = "appliedenergistics2",
+ striprefs = true),
+ @Optional.Interface(
+ iface = "appeng.me.helpers.IGridProxyable",
+ modid = "appliedenergistics2",
+ striprefs = true) })
+public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTechTileEntity, IActionHost,
+ IGridProxyable, IAlignmentProvider, IConstructableProvider, IDebugableTileEntity, IGregtechWailaProvider {
+
+ private static final Field ENTITY_ITEM_HEALTH_FIELD = ReflectionHelper
+ .findField(EntityItem.class, "health", "field_70291_e");
+ private final boolean[] mActiveEUInputs = new boolean[] { false, false, false, false, false, false };
+ private final boolean[] mActiveEUOutputs = new boolean[] { false, false, false, false, false, false };
private final int[] mTimeStatistics = new int[GregTech_API.TICKS_FOR_LAG_AVERAGING];
public long mLastSoundTick = 0;
public boolean mWasShutdown = false;
@@ -104,28 +104,14 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
protected long mStoredEnergy = 0, mStoredSteam = 0;
protected int mAverageEUInputIndex = 0, mAverageEUOutputIndex = 0;
protected boolean mReleaseEnergy = false;
- protected long[] mAverageEUInput = new long[] {0, 0, 0, 0, 0}, mAverageEUOutput = new long[] {0, 0, 0, 0, 0};
- private boolean mHasEnoughEnergy = true,
- mRunningThroughTick = false,
- mInputDisabled = false,
- mOutputDisabled = false,
- mMuffler = false,
- mLockUpgrade = false;
+ protected long[] mAverageEUInput = new long[] { 0, 0, 0, 0, 0 }, mAverageEUOutput = new long[] { 0, 0, 0, 0, 0 };
+ private boolean mHasEnoughEnergy = true, mRunningThroughTick = false, mInputDisabled = false,
+ mOutputDisabled = false, mMuffler = false, mLockUpgrade = false;
private boolean mActive = false, mWorkUpdate = false, mSteamConverter = false, mWorks = true;
private boolean oRedstone = false;
- private byte mColor = 0,
- oColor = 0,
- oStrongRedstone = 0,
- oRedstoneData = 63,
- oTextureData = 0,
- oUpdateData = 0,
+ private byte mColor = 0, oColor = 0, oStrongRedstone = 0, oRedstoneData = 63, oTextureData = 0, oUpdateData = 0,
oTexturePage = 0;
- private byte oLightValueClient = 0,
- oLightValue = -1,
- mLightValue = 0,
- mOtherUpgrades = 0,
- mFacing = 0,
- oFacing = 0,
+ private byte oLightValueClient = 0, oLightValue = -1, mLightValue = 0, mOtherUpgrades = 0, mFacing = 0, oFacing = 0,
mWorkData = 0;
private int mDisplayErrorCode = 0, oX = 0, oY = 0, oZ = 0, mTimeStatisticsIndex = 0, mLagWarningCount = 0;
private long oOutput = 0, mAcceptedAmperes = Long.MAX_VALUE;
@@ -184,8 +170,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
else mID = mID > 0 ? mID : 0;
if (mID != 0) createNewMetatileEntity(mID);
mSidedRedstone = (hasValidMetaTileEntity() && mMetaTileEntity.hasSidedRedstoneOutputBehavior()
- ? new byte[] {0, 0, 0, 0, 0, 0}
- : new byte[] {15, 15, 15, 15, 15, 15});
+ ? new byte[] { 0, 0, 0, 0, 0, 0 }
+ : new byte[] { 15, 15, 15, 15, 15, 15 });
} else {
if (aID <= 0) mID = (short) aNBT.getInteger("mID");
else mID = aID;
@@ -208,8 +194,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
mWorks = !aNBT.getBoolean("mWorks");
mInputDisabled = aNBT.getBoolean("mInputDisabled");
mOutputDisabled = aNBT.getBoolean("mOutputDisabled");
- mOtherUpgrades =
- (byte) (aNBT.getByte("mOtherUpgrades") + aNBT.getByte("mBatteries") + aNBT.getByte("mLiBatteries"));
+ mOtherUpgrades = (byte) (aNBT.getByte("mOtherUpgrades") + aNBT.getByte("mBatteries")
+ + aNBT.getByte("mLiBatteries"));
mRecipeStuff = aNBT.getCompoundTag("GT.CraftingComponents");
final int nbtVersion = aNBT.getInteger("nbtVersion");
@@ -219,15 +205,15 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
if (mSidedRedstone.length != 6)
if (hasValidMetaTileEntity() && mMetaTileEntity.hasSidedRedstoneOutputBehavior())
- mSidedRedstone = new byte[] {0, 0, 0, 0, 0, 0};
- else mSidedRedstone = new byte[] {15, 15, 15, 15, 15, 15};
+ mSidedRedstone = new byte[] { 0, 0, 0, 0, 0, 0 };
+ else mSidedRedstone = new byte[] { 15, 15, 15, 15, 15, 15 };
updateCoverBehavior();
}
/**
- * Used for ticking special BaseMetaTileEntities, which need that for Energy Conversion
- * It's called right before onPostTick()
+ * Used for ticking special BaseMetaTileEntities, which need that for Energy Conversion It's called right before
+ * onPostTick()
*/
public void updateStatus() {
//
@@ -279,17 +265,13 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
final int precipitationHeightAtSide4 = worldObj.getPrecipitationHeight(xCoord - 1, zCoord);
final int precipitationHeightAtSide5 = worldObj.getPrecipitationHeight(xCoord + 1, zCoord);
return (getCoverIDAtSide((byte) 1) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord) - 2 < yCoord)
- || (getCoverIDAtSide((byte) 2) == 0
- && precipitationHeightAtSide2 - 1 < yCoord
+ || (getCoverIDAtSide((byte) 2) == 0 && precipitationHeightAtSide2 - 1 < yCoord
&& precipitationHeightAtSide2 > -1)
- || (getCoverIDAtSide((byte) 3) == 0
- && precipitationHeightAtSide3 - 1 < yCoord
+ || (getCoverIDAtSide((byte) 3) == 0 && precipitationHeightAtSide3 - 1 < yCoord
&& precipitationHeightAtSide3 > -1)
- || (getCoverIDAtSide((byte) 4) == 0
- && precipitationHeightAtSide4 - 1 < yCoord
+ || (getCoverIDAtSide((byte) 4) == 0 && precipitationHeightAtSide4 - 1 < yCoord
&& precipitationHeightAtSide4 > -1)
- || (getCoverIDAtSide((byte) 5) == 0
- && precipitationHeightAtSide5 - 1 < yCoord
+ || (getCoverIDAtSide((byte) 5) == 0 && precipitationHeightAtSide5 - 1 < yCoord
&& precipitationHeightAtSide5 > -1);
}
@@ -413,14 +395,14 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
}
if (mMetaTileEntity.isEnetOutput() && oOutput > 0) {
- final long tOutputVoltage =
- Math.max(oOutput, oOutput + (1L << Math.max(0, GT_Utility.getTier(oOutput) - 1)));
+ final long tOutputVoltage = Math
+ .max(oOutput, oOutput + (1L << Math.max(0, GT_Utility.getTier(oOutput) - 1)));
final long tUsableAmperage = Math.min(
getOutputAmperage(),
(getStoredEU() - mMetaTileEntity.getMinimumStoredEU()) / tOutputVoltage);
if (tUsableAmperage > 0) {
- final long tEU =
- tOutputVoltage * Util.emitEnergyToNetwork(oOutput, tUsableAmperage, this);
+ final long tEU = tOutputVoltage
+ * Util.emitEnergyToNetwork(oOutput, tUsableAmperage, this);
mAverageEUOutput[mAverageEUOutputIndex] += tEU;
decreaseStoredEU(tEU, true);
}
@@ -444,21 +426,29 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
if (getRandomNumber(10) == 0) {
try {
GT_Mod.achievements.issueAchievement(
- this.getWorldObj()
- .getPlayerEntityByName(mOwnerName),
+ this.getWorldObj().getPlayerEntityByName(mOwnerName),
"badweather");
- } catch (Exception ignored) {
- }
- GT_Log.exp.println("Machine at: " + this.getXCoord() + " | "
- + this.getYCoord() + " | " + this.getZCoord() + " DIMID: "
- + this.worldObj.provider.dimensionId
- + " explosion due to rain!");
+ } catch (Exception ignored) {}
+ GT_Log.exp.println(
+ "Machine at: " + this.getXCoord()
+ + " | "
+ + this.getYCoord()
+ + " | "
+ + this.getZCoord()
+ + " DIMID: "
+ + this.worldObj.provider.dimensionId
+ + " explosion due to rain!");
doEnergyExplosion();
} else {
- GT_Log.exp.println("Machine at: " + this.getXCoord() + " | "
- + this.getYCoord() + " | " + this.getZCoord() + " DIMID: "
- + this.worldObj.provider.dimensionId
- + " set to Fire due to rain!");
+ GT_Log.exp.println(
+ "Machine at: " + this.getXCoord()
+ + " | "
+ + this.getYCoord()
+ + " | "
+ + this.getZCoord()
+ + " DIMID: "
+ + this.worldObj.provider.dimensionId
+ + " set to Fire due to rain!");
setOnFire();
}
}
@@ -466,18 +456,20 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
mRunningThroughTick = false;
return;
}
- if (GregTech_API.sMachineThunderExplosions
- && worldObj.isThundering()
+ if (GregTech_API.sMachineThunderExplosions && worldObj.isThundering()
&& getRandomNumber(3) == 0) {
try {
GT_Mod.achievements.issueAchievement(
this.getWorldObj().getPlayerEntityByName(mOwnerName),
"badweather");
- } catch (Exception ignored) {
- }
+ } catch (Exception ignored) {}
GT_Log.exp.println(
- "Machine at: " + this.getXCoord() + " | " + this.getYCoord()
- + " | " + this.getZCoord() + " DIMID: "
+ "Machine at: " + this.getXCoord()
+ + " | "
+ + this.getYCoord()
+ + " | "
+ + this.getZCoord()
+ + " DIMID: "
+ this.worldObj.provider.dimensionId
+ " explosion due to Thunderstorm!");
doEnergyExplosion();
@@ -497,19 +489,15 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
if (aSideServer) {
if (mMetaTileEntity.dechargerSlotCount() > 0 && getStoredEU() < getEUCapacity()) {
for (int i = mMetaTileEntity.dechargerSlotStartIndex(),
- k = mMetaTileEntity.dechargerSlotCount() + i;
- i < k;
- i++) {
+ k = mMetaTileEntity.dechargerSlotCount() + i; i < k; i++) {
if (mMetaTileEntity.mInventory[i] != null && getStoredEU() < getEUCapacity()) {
dischargeItem(mMetaTileEntity.mInventory[i]);
if (ic2.api.info.Info.itemEnergy.getEnergyValue(mMetaTileEntity.mInventory[i]) > 0) {
- if ((getStoredEU()
- + ic2.api.info.Info.itemEnergy.getEnergyValue(
- mMetaTileEntity.mInventory[i]))
- < getEUCapacity()) {
+ if ((getStoredEU() + ic2.api.info.Info.itemEnergy
+ .getEnergyValue(mMetaTileEntity.mInventory[i])) < getEUCapacity()) {
increaseStoredEnergyUnits(
- (long) ic2.api.info.Info.itemEnergy.getEnergyValue(
- mMetaTileEntity.mInventory[i]),
+ (long) ic2.api.info.Info.itemEnergy
+ .getEnergyValue(mMetaTileEntity.mInventory[i]),
false);
mMetaTileEntity.mInventory[i].stackSize--;
mInventoryChanged = true;
@@ -526,9 +514,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
if (aSideServer) {
if (mMetaTileEntity.rechargerSlotCount() > 0 && getStoredEU() > 0) {
for (int i = mMetaTileEntity.rechargerSlotStartIndex(),
- k = mMetaTileEntity.rechargerSlotCount() + i;
- i < k;
- i++) {
+ k = mMetaTileEntity.rechargerSlotCount() + i; i < k; i++) {
if (getStoredEU() > 0 && mMetaTileEntity.mInventory[i] != null) {
chargeItem(mMetaTileEntity.mInventory[i]);
if (mMetaTileEntity.mInventory[i].stackSize <= 0) {
@@ -559,8 +545,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
}
if (mTickTimer > 10) {
- byte tData = (byte) ((mFacing & 7)
- | (mActive ? 8 : 0)
+ byte tData = (byte) ((mFacing & 7) | (mActive ? 8 : 0)
| (mRedstone ? 16 : 0)
| (mLockUpgrade ? 32 : 0)
| (mWorks ? 64 : 0));
@@ -572,13 +557,12 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
sendBlockEvent(GregTechTileClientEvents.CHANGE_CUSTOM_DATA, oUpdateData = tData);
if (mMetaTileEntity instanceof GT_MetaTileEntity_Hatch) {
tData = ((GT_MetaTileEntity_Hatch) mMetaTileEntity).getTexturePage();
- if (tData != oTexturePage)
- sendBlockEvent(GregTechTileClientEvents.CHANGE_CUSTOM_DATA, (byte)
- ((oTexturePage = tData) | 0x80)); // set last bit as a flag for page
+ if (tData != oTexturePage) sendBlockEvent(
+ GregTechTileClientEvents.CHANGE_CUSTOM_DATA,
+ (byte) ((oTexturePage = tData) | 0x80)); // set last bit as a flag for page
}
if (mColor != oColor) sendBlockEvent(GregTechTileClientEvents.CHANGE_COLOR, oColor = mColor);
- tData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0)
- | ((mSidedRedstone[1] > 0) ? 2 : 0)
+ tData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0)
| ((mSidedRedstone[2] > 0) ? 4 : 0)
| ((mSidedRedstone[3] > 0) ? 8 : 0)
| ((mSidedRedstone[4] > 0) ? 16 : 0)
@@ -613,25 +597,32 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
if (aSideServer && hasValidMetaTileEntity()) {
tTime = System.nanoTime() - tTime;
- if (mTimeStatistics.length > 0)
- mTimeStatistics[mTimeStatisticsIndex = (mTimeStatisticsIndex + 1) % mTimeStatistics.length] =
- (int) tTime;
- if (tTime > 0
- && tTime > (GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING * 1000000L)
+ if (mTimeStatistics.length > 0) mTimeStatistics[mTimeStatisticsIndex = (mTimeStatisticsIndex + 1)
+ % mTimeStatistics.length] = (int) tTime;
+ if (tTime > 0 && tTime > (GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING * 1000000L)
&& mTickTimer > 1000
&& getMetaTileEntity().doTickProfilingMessageDuringThisTick()
&& mLagWarningCount++ < 10)
- GT_FML_LOGGER.warn("WARNING: Possible Lag Source at [" + xCoord + ", " + yCoord + ", " + zCoord
- + "] in Dimension " + worldObj.provider.dimensionId + " with " + tTime
- + "ns caused by an instance of " + getMetaTileEntity().getClass());
+ GT_FML_LOGGER.warn(
+ "WARNING: Possible Lag Source at [" + xCoord
+ + ", "
+ + yCoord
+ + ", "
+ + zCoord
+ + "] in Dimension "
+ + worldObj.provider.dimensionId
+ + " with "
+ + tTime
+ + "ns caused by an instance of "
+ + getMetaTileEntity().getClass());
}
mWorkUpdate = mInventoryChanged = mRunningThroughTick = false;
}
@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) {
if (hasValidMetaTileEntity()) {
getMetaTileEntity().getWailaBody(itemStack, currenttip, accessor, config);
}
@@ -639,8 +630,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
}
@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);
if (hasValidMetaTileEntity()) {
getMetaTileEntity().getWailaNBTData(player, tile, tag, world, x, y, z);
@@ -662,13 +653,12 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
getCoverInfoAtSide((byte) 3).getCoverID(),
getCoverInfoAtSide((byte) 4).getCoverID(),
getCoverInfoAtSide((byte) 5).getCoverID(),
- oTextureData = (byte) ((mFacing & 7)
- | (mActive ? 8 : 0)
+ oTextureData = (byte) ((mFacing & 7) | (mActive ? 8 : 0)
| (mRedstone ? 16 : 0)
| (mLockUpgrade ? 32 : 0)
| (mWorks ? 64 : 0)),
- oTexturePage =
- (hasValidMetaTileEntity() && mMetaTileEntity instanceof GT_MetaTileEntity_Hatch)
+ oTexturePage = (hasValidMetaTileEntity()
+ && mMetaTileEntity instanceof GT_MetaTileEntity_Hatch)
? ((GT_MetaTileEntity_Hatch) mMetaTileEntity).getTexturePage()
: 0,
oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0,
@@ -686,18 +676,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
sendCoverDataIfNeeded();
}
- public final void receiveMetaTileEntityData(
- short aID,
- int aCover0,
- int aCover1,
- int aCover2,
- int aCover3,
- int aCover4,
- int aCover5,
- byte aTextureData,
- byte aTexturePage,
- byte aUpdateData,
- byte aRedstoneData,
+ public final void receiveMetaTileEntityData(short aID, int aCover0, int aCover1, int aCover2, int aCover3,
+ int aCover4, int aCover5, byte aTextureData, byte aTexturePage, byte aUpdateData, byte aRedstoneData,
byte aColorData) {
issueTextureUpdate();
if (mID != aID && aID > 0) {
@@ -720,18 +700,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
}
@Deprecated
- public final void receiveMetaTileEntityData(
- short aID,
- int aCover0,
- int aCover1,
- int aCover2,
- int aCover3,
- int aCover4,
- int aCover5,
- byte aTextureData,
- byte aUpdateData,
- byte aRedstoneData,
- byte aColorData) {
+ public final void receiveMetaTileEntityData(short aID, int aCover0, int aCover1, int aCover2, int aCover3,
+ int aCover4, int aCover5, byte aTextureData, byte aUpdateData, byte aRedstoneData, byte aColorData) {
receiveMetaTileEntityData(
aID,
aCover0,
@@ -768,15 +738,15 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
mFacing = (byte) (aValue & 7);
mActive = ((aValue & 8) != 0);
mRedstone = ((aValue & 16) != 0);
- // mLockUpgrade = ((aValue&32) != 0);
+ // mLockUpgrade = ((aValue&32) != 0);
mWorks = ((aValue & 64) != 0);
break;
case GregTechTileClientEvents.CHANGE_CUSTOM_DATA:
if (hasValidMetaTileEntity()) {
if ((aValue & 0x80) == 0) // Is texture index
- mMetaTileEntity.onValueUpdate((byte) (aValue & 0x7F));
+ mMetaTileEntity.onValueUpdate((byte) (aValue & 0x7F));
else if (mMetaTileEntity instanceof GT_MetaTileEntity_Hatch) // is texture page and hatch
- ((GT_MetaTileEntity_Hatch) mMetaTileEntity).onTexturePageUpdate((byte) (aValue & 0x7F));
+ ((GT_MetaTileEntity_Hatch) mMetaTileEntity).onTexturePageUpdate((byte) (aValue & 0x7F));
}
break;
case GregTechTileClientEvents.CHANGE_COLOR:
@@ -815,13 +785,15 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
public ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aLogLevel) {
final ArrayList<String> tList = new ArrayList<>();
if (aLogLevel > 2) {
- tList.add("Meta-ID: " + EnumChatFormatting.BLUE + mID + EnumChatFormatting.RESET
- + (canAccessData()
- ? EnumChatFormatting.GREEN + " valid" + EnumChatFormatting.RESET
- : EnumChatFormatting.RED + " invalid" + EnumChatFormatting.RESET)
- + (mMetaTileEntity == null
- ? EnumChatFormatting.RED + " MetaTileEntity == null!" + EnumChatFormatting.RESET
- : " "));
+ tList.add(
+ "Meta-ID: " + EnumChatFormatting.BLUE
+ + mID
+ + EnumChatFormatting.RESET
+ + (canAccessData() ? EnumChatFormatting.GREEN + " valid" + EnumChatFormatting.RESET
+ : EnumChatFormatting.RED + " invalid" + EnumChatFormatting.RESET)
+ + (mMetaTileEntity == null
+ ? EnumChatFormatting.RED + " MetaTileEntity == null!" + EnumChatFormatting.RESET
+ : " "));
}
if (aLogLevel > 1) {
if (mTimeStatistics.length > 0) {
@@ -835,36 +807,42 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
// Uncomment this line to print out tick-by-tick times.
// tList.add("tTime " + tTime);
}
- tList.add("Average CPU load of ~" + GT_Utility.formatNumbers(tAverageTime / mTimeStatistics.length)
- + "ns over " + GT_Utility.formatNumbers(mTimeStatistics.length) + " ticks with worst time of "
- + GT_Utility.formatNumbers(tWorstTime) + "ns.");
- tList.add("Recorded " + GT_Utility.formatNumbers(mMetaTileEntity.mSoundRequests) + " sound requests in "
- + GT_Utility.formatNumbers(mTickTimer - mLastCheckTick) + " ticks.");
+ tList.add(
+ "Average CPU load of ~" + GT_Utility.formatNumbers(tAverageTime / mTimeStatistics.length)
+ + "ns over "
+ + GT_Utility.formatNumbers(mTimeStatistics.length)
+ + " ticks with worst time of "
+ + GT_Utility.formatNumbers(tWorstTime)
+ + "ns.");
+ tList.add(
+ "Recorded " + GT_Utility.formatNumbers(mMetaTileEntity.mSoundRequests)
+ + " sound requests in "
+ + GT_Utility.formatNumbers(mTickTimer - mLastCheckTick)
+ + " ticks.");
mLastCheckTick = mTickTimer;
mMetaTileEntity.mSoundRequests = 0;
}
if (mLagWarningCount > 0) {
- tList.add("Caused " + (mLagWarningCount >= 10 ? "more than 10" : mLagWarningCount)
- + " Lag Spike Warnings (anything taking longer than "
- + GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING + "ms) on the Server.");
+ tList.add(
+ "Caused " + (mLagWarningCount >= 10 ? "more than 10" : mLagWarningCount)
+ + " Lag Spike Warnings (anything taking longer than "
+ + GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING
+ + "ms) on the Server.");
}
- tList.add("Is"
- + (mMetaTileEntity.isAccessAllowed(aPlayer)
- ? " "
- : EnumChatFormatting.RED + " not " + EnumChatFormatting.RESET)
- + "accessible for you");
+ tList.add(
+ "Is" + (mMetaTileEntity.isAccessAllowed(aPlayer) ? " "
+ : EnumChatFormatting.RED + " not " + EnumChatFormatting.RESET) + "accessible for you");
}
if (aLogLevel > 0) {
- if (getSteamCapacity() > 0 && hasSteamEngineUpgrade())
- tList.add(GT_Utility.formatNumbers(getStoredSteam()) + " of "
- + GT_Utility.formatNumbers(getSteamCapacity()) + " Steam");
- tList.add("Machine is "
- + (mActive
- ? EnumChatFormatting.GREEN + "active" + EnumChatFormatting.RESET
+ if (getSteamCapacity() > 0 && hasSteamEngineUpgrade()) tList.add(
+ GT_Utility.formatNumbers(getStoredSteam()) + " of "
+ + GT_Utility.formatNumbers(getSteamCapacity())
+ + " Steam");
+ tList.add(
+ "Machine is " + (mActive ? EnumChatFormatting.GREEN + "active" + EnumChatFormatting.RESET
: EnumChatFormatting.RED + "inactive" + EnumChatFormatting.RESET));
- if (!mHasEnoughEnergy)
- tList.add(
- EnumChatFormatting.RED + "ATTENTION: This Device needs more power." + EnumChatFormatting.RESET);
+ if (!mHasEnoughEnergy) tList.add(
+ EnumChatFormatting.RED + "ATTENTION: This Device needs more power." + EnumChatFormatting.RESET);
}
if (joinedIc2Enet) tList.add("Joined IC2 ENet");
return mMetaTileEntity.getSpecialDebugInfo(this, aPlayer, aLogLevel, tList);
@@ -923,7 +901,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
if (canAccessData()) {
markDirty();
mMetaTileEntity.setInventorySlotContents(
- aIndex, worldObj.isRemote ? aStack : GT_OreDictUnificator.setStack(true, aStack));
+ aIndex,
+ worldObj.isRemote ? aStack : GT_OreDictUnificator.setStack(true, aStack));
}
}
@@ -952,8 +931,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
@Override
public boolean isUseableByPlayer(EntityPlayer aPlayer) {
- return canAccessData()
- && playerOwnsThis(aPlayer, false)
+ return canAccessData() && playerOwnsThis(aPlayer, false)
&& mTickTimer > 40
&& getTileEntityOffset(0, 0, 0) == this
&& aPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64
@@ -1093,8 +1071,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
@Override
public boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy) {
if (!canAccessData()) return false;
- return mHasEnoughEnergy = decreaseStoredEU(aEnergy, aIgnoreTooLessEnergy)
- || decreaseStoredSteam(aEnergy, false)
+ return mHasEnoughEnergy = decreaseStoredEU(aEnergy, aIgnoreTooLessEnergy) || decreaseStoredSteam(aEnergy, false)
|| (aIgnoreTooLessEnergy && (decreaseStoredSteam(aEnergy, true)));
}
@@ -1236,9 +1213,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
@Override
public ITexture[] getTexture(Block aBlock, byte aSide) {
final ITexture coverTexture = getCoverTexture(aSide);
- final ITexture[] textureUncovered = hasValidMetaTileEntity()
- ? mMetaTileEntity.getTexture(
- this, aSide, mFacing, (byte) (mColor - 1), mActive, getOutputRedstoneSignal(aSide) > 0)
+ final ITexture[] textureUncovered = hasValidMetaTileEntity() ? mMetaTileEntity
+ .getTexture(this, aSide, mFacing, (byte) (mColor - 1), mActive, getOutputRedstoneSignal(aSide) > 0)
: Textures.BlockIcons.ERROR_RENDERING;
final ITexture[] textureCovered;
if (coverTexture != null) {
@@ -1328,11 +1304,9 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
if ((mOwnerName.length() == 0) && isServerSide()) {
setOwnerName(aPlayer.getDisplayName());
setOwnerUuid(aPlayer.getUniqueID());
- } else
- return !privateAccess()
- || aPlayer.getDisplayName().equals("Player")
- || mOwnerName.equals("Player")
- || mOwnerName.equals(aPlayer.getDisplayName());
+ } else return !privateAccess() || aPlayer.getDisplayName().equals("Player")
+ || mOwnerName.equals("Player")
+ || mOwnerName.equals(aPlayer.getDisplayName());
return true;
}
@@ -1343,15 +1317,17 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
public void doEnergyExplosion() {
if (getUniversalEnergyCapacity() > 0 && getUniversalEnergyStored() >= getUniversalEnergyCapacity() / 5) {
- GT_Log.exp.println("Energy Explosion, injected " + getUniversalEnergyStored() + "EU >= "
- + getUniversalEnergyCapacity() / 5D + "Capacity of the Machine!");
+ GT_Log.exp.println(
+ "Energy Explosion, injected " + getUniversalEnergyStored()
+ + "EU >= "
+ + getUniversalEnergyCapacity() / 5D
+ + "Capacity of the Machine!");
- doExplosion(oOutput
- * (getUniversalEnergyStored() >= getUniversalEnergyCapacity()
- ? 4
+ doExplosion(
+ oOutput * (getUniversalEnergyStored() >= getUniversalEnergyCapacity() ? 4
: getUniversalEnergyStored() >= getUniversalEnergyCapacity() / 2 ? 2 : 1));
- GT_Mod.achievements.issueAchievement(
- this.getWorldObj().getPlayerEntityByName(mOwnerName), "electricproblems");
+ GT_Mod.achievements
+ .issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "electricproblems");
}
}
@@ -1363,8 +1339,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
try {
mReleaseEnergy = true;
IEnergyConnected.Util.emitEnergyToNetwork(V[5], Math.max(1, getStoredEU() / V[5]), this);
- } catch (Exception ignored) {
- }
+ } catch (Exception ignored) {}
}
mReleaseEnergy = false;
// Normal Explosion Code
@@ -1400,8 +1375,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
this.zCoord + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F,
new ItemStack(tItem.getItem(), tItem.stackSize, tItem.getItemDamage()));
if (tItem.hasTagCompound()) {
- tItemEntity.getEntityItem().setTagCompound((NBTTagCompound)
- tItem.getTagCompound().copy());
+ tItemEntity.getEntityItem().setTagCompound((NBTTagCompound) tItem.getTagCompound().copy());
}
tItemEntity.motionX = (XSTR_INSTANCE.nextGaussian() * 0.0500000007450581D);
tItemEntity.motionY = (XSTR_INSTANCE.nextGaussian() * 0.0500000007450581D + 0.2000000029802322D);
@@ -1410,8 +1384,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
tItemEntity.lifespan = 60000;
try {
if (ENTITY_ITEM_HEALTH_FIELD != null) ENTITY_ITEM_HEALTH_FIELD.setInt(tItemEntity, 99999999);
- } catch (Exception ignored) {
- }
+ } catch (Exception ignored) {}
this.worldObj.spawnEntityInWorld(tItemEntity);
tItem.stackSize = 0;
}
@@ -1450,8 +1423,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
if (isClientSide()) {
// Configure Cover, sneak can also be: screwdriver, wrench, side cutter, soldering iron
if (aPlayer.isSneaking()) {
- final byte tSide =
- (getCoverIDAtSide(aSide) == 0) ? GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ) : aSide;
+ final byte tSide = (getCoverIDAtSide(aSide) == 0) ? GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ)
+ : aSide;
return (getCoverBehaviorAtSideNew(tSide).hasCoverGUI());
} else if (getCoverBehaviorAtSideNew(aSide).onCoverRightclickClient(aSide, this, aPlayer, aX, aY, aZ)) {
return true;
@@ -1471,21 +1444,37 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
return true;
}
if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList)) {
- if (aPlayer.isSneaking()
- && mMetaTileEntity instanceof GT_MetaTileEntity_BasicMachine
+ if (aPlayer.isSneaking() && mMetaTileEntity instanceof GT_MetaTileEntity_BasicMachine
&& ((GT_MetaTileEntity_BasicMachine) mMetaTileEntity)
.setMainFacing(GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ))) {
GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer);
GT_Utility.sendSoundToPlayers(
- worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord);
+ worldObj,
+ SoundResource.IC2_TOOLS_WRENCH,
+ 1.0F,
+ -1,
+ xCoord,
+ yCoord,
+ zCoord);
cableUpdateDelay = 10;
} else if (mMetaTileEntity.onWrenchRightClick(
- aSide, GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ), aPlayer, aX, aY, aZ)) {
- GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer);
- GT_Utility.sendSoundToPlayers(
- worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord);
- cableUpdateDelay = 10;
- }
+ aSide,
+ GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ),
+ aPlayer,
+ aX,
+ aY,
+ aZ)) {
+ GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer);
+ GT_Utility.sendSoundToPlayers(
+ worldObj,
+ SoundResource.IC2_TOOLS_WRENCH,
+ 1.0F,
+ -1,
+ xCoord,
+ yCoord,
+ zCoord);
+ cableUpdateDelay = 10;
+ }
return true;
}
@@ -1493,19 +1482,24 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 200, aPlayer)) {
setCoverDataAtSide(
aSide,
- getCoverBehaviorAtSideNew(aSide)
- .onCoverScrewdriverClick(
- aSide,
- getCoverIDAtSide(aSide),
- getComplexCoverDataAtSide(aSide),
- this,
- aPlayer,
- aX,
- aY,
- aZ));
+ getCoverBehaviorAtSideNew(aSide).onCoverScrewdriverClick(
+ aSide,
+ getCoverIDAtSide(aSide),
+ getComplexCoverDataAtSide(aSide),
+ this,
+ aPlayer,
+ aX,
+ aY,
+ aZ));
mMetaTileEntity.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
GT_Utility.sendSoundToPlayers(
- worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord);
+ worldObj,
+ SoundResource.IC2_TOOLS_WRENCH,
+ 1.0F,
+ -1,
+ xCoord,
+ yCoord,
+ zCoord);
}
return true;
}
@@ -1514,18 +1508,24 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) {
mInputDisabled = !mInputDisabled;
if (mInputDisabled) mOutputDisabled = !mOutputDisabled;
- GT_Utility.sendChatToPlayer(
- aPlayer,
- GT_Utility.trans("086", "Auto-Input: ")
- + (mInputDisabled
- ? GT_Utility.trans("087", "Disabled")
- : GT_Utility.trans("088", "Enabled")
- + GT_Utility.trans("089", " Auto-Output: ")
- + (mOutputDisabled
- ? GT_Utility.trans("087", "Disabled")
- : GT_Utility.trans("088", "Enabled"))));
+ GT_Utility
+ .sendChatToPlayer(
+ aPlayer,
+ GT_Utility.trans("086", "Auto-Input: ")
+ + (mInputDisabled ? GT_Utility.trans("087", "Disabled")
+ : GT_Utility.trans("088", "Enabled")
+ + GT_Utility.trans("089", " Auto-Output: ")
+ + (mOutputDisabled
+ ? GT_Utility.trans("087", "Disabled")
+ : GT_Utility.trans("088", "Enabled"))));
GT_Utility.sendSoundToPlayers(
- worldObj, SoundResource.RANDOM_ANVIL_USE, 1.0F, -1, xCoord, yCoord, zCoord);
+ worldObj,
+ SoundResource.RANDOM_ANVIL_USE,
+ 1.0F,
+ -1,
+ xCoord,
+ yCoord,
+ zCoord);
}
return true;
}
@@ -1536,11 +1536,9 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
else enableWorking();
{
String tChat = GT_Utility.trans("090", "Machine Processing: ")
- + (isAllowedToWork()
- ? GT_Utility.trans("088", "Enabled")
+ + (isAllowedToWork() ? GT_Utility.trans("088", "Enabled")
: GT_Utility.trans("087", "Disabled"));
- if (getMetaTileEntity() != null
- && getMetaTileEntity().hasAlternativeModeText())
+ if (getMetaTileEntity() != null && getMetaTileEntity().hasAlternativeModeText())
tChat = getMetaTileEntity().getAlternativeModeText();
GT_Utility.sendChatToPlayer(aPlayer, tChat);
}
@@ -1561,19 +1559,29 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
if (mMetaTileEntity.onSolderingToolRightClick(aSide, tSide, aPlayer, aX, aY, aZ)) {
// logic handled internally
GT_Utility.sendSoundToPlayers(
- worldObj, SoundResource.IC2_TOOLS_BATTERY_USE, 1.0F, -1, xCoord, yCoord, zCoord);
+ worldObj,
+ SoundResource.IC2_TOOLS_BATTERY_USE,
+ 1.0F,
+ -1,
+ xCoord,
+ yCoord,
+ zCoord);
} else if (GT_ModHandler.useSolderingIron(tCurrentItem, aPlayer)) {
mStrongRedstone ^= (1 << tSide);
GT_Utility.sendChatToPlayer(
aPlayer,
- GT_Utility.trans("091", "Redstone Output at Side ")
- + tSide
+ GT_Utility.trans("091", "Redstone Output at Side ") + tSide
+ GT_Utility.trans("092", " set to: ")
- + ((mStrongRedstone & (1 << tSide)) != 0
- ? GT_Utility.trans("093", "Strong")
+ + ((mStrongRedstone & (1 << tSide)) != 0 ? GT_Utility.trans("093", "Strong")
: GT_Utility.trans("094", "Weak")));
GT_Utility.sendSoundToPlayers(
- worldObj, SoundResource.IC2_TOOLS_BATTERY_USE, 3.0F, -1, xCoord, yCoord, zCoord);
+ worldObj,
+ SoundResource.IC2_TOOLS_BATTERY_USE,
+ 3.0F,
+ -1,
+ xCoord,
+ yCoord,
+ zCoord);
issueBlockUpdate();
}
doEnetUpdate();
@@ -1586,7 +1594,13 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
if (mMetaTileEntity.onWireCutterRightClick(aSide, tSide, aPlayer, aX, aY, aZ)) {
// logic handled internally
GT_Utility.sendSoundToPlayers(
- worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord);
+ worldObj,
+ SoundResource.IC2_TOOLS_WRENCH,
+ 1.0F,
+ -1,
+ xCoord,
+ yCoord,
+ zCoord);
}
doEnetUpdate();
cableUpdateDelay = 10;
@@ -1599,12 +1613,18 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
if (getCoverIDAtSide(coverSide) == 0) {
if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCovers.keySet())) {
if (GregTech_API.getCoverBehaviorNew(tCurrentItem)
- .isCoverPlaceable(coverSide, tCurrentItem, this)
+ .isCoverPlaceable(coverSide, tCurrentItem, this)
&& mMetaTileEntity.allowCoverOnSide(coverSide, new GT_ItemStack(tCurrentItem))) {
setCoverItemAtSide(coverSide, tCurrentItem);
if (!aPlayer.capabilities.isCreativeMode) tCurrentItem.stackSize--;
GT_Utility.sendSoundToPlayers(
- worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord);
+ worldObj,
+ SoundResource.IC2_TOOLS_WRENCH,
+ 1.0F,
+ -1,
+ xCoord,
+ yCoord,
+ zCoord);
}
return true;
}
@@ -1612,7 +1632,13 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCrowbarList)) {
if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) {
GT_Utility.sendSoundToPlayers(
- worldObj, SoundResource.RANDOM_BREAK, 1.0F, -1, xCoord, yCoord, zCoord);
+ worldObj,
+ SoundResource.RANDOM_BREAK,
+ 1.0F,
+ -1,
+ xCoord,
+ yCoord,
+ zCoord);
dropCover(coverSide, aSide, false);
}
return true;
@@ -1620,29 +1646,26 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
}
// End item != null
} else if (aPlayer.isSneaking()) { // Sneak click, no tool -> open cover config if possible.
- aSide = (getCoverIDAtSide(aSide) == 0)
- ? GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ)
+ aSide = (getCoverIDAtSide(aSide) == 0) ? GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ)
: aSide;
- return getCoverIDAtSide(aSide) > 0
- && getCoverBehaviorAtSideNew(aSide)
- .onCoverShiftRightClick(
- aSide,
- getCoverIDAtSide(aSide),
- getComplexCoverDataAtSide(aSide),
- this,
- aPlayer);
+ return getCoverIDAtSide(aSide) > 0 && getCoverBehaviorAtSideNew(aSide).onCoverShiftRightClick(
+ aSide,
+ getCoverIDAtSide(aSide),
+ getComplexCoverDataAtSide(aSide),
+ this,
+ aPlayer);
}
- if (getCoverBehaviorAtSideNew(aSide)
- .onCoverRightClick(
- aSide,
- getCoverIDAtSide(aSide),
- getComplexCoverDataAtSide(aSide),
- this,
- aPlayer,
- aX,
- aY,
- aZ)) return true;
+ if (getCoverBehaviorAtSideNew(aSide).onCoverRightClick(
+ aSide,
+ getCoverIDAtSide(aSide),
+ getComplexCoverDataAtSide(aSide),
+ this,
+ aPlayer,
+ aX,
+ aY,
+ aZ))
+ return true;
if (!getCoverInfoAtSide(aSide).isGUIClickable()) return false;
@@ -1650,7 +1673,13 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
if (ItemList.Upgrade_Muffler.isStackEqual(aPlayer.inventory.getCurrentItem())) {
if (addMufflerUpgrade()) {
GT_Utility.sendSoundToPlayers(
- worldObj, SoundResource.RANDOM_CLICK, 1.0F, -1, xCoord, yCoord, zCoord);
+ worldObj,
+ SoundResource.RANDOM_CLICK,
+ 1.0F,
+ -1,
+ xCoord,
+ yCoord,
+ zCoord);
if (!aPlayer.capabilities.isCreativeMode) aPlayer.inventory.getCurrentItem().stackSize--;
}
return true;
@@ -1661,7 +1690,13 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
setOwnerName(aPlayer.getDisplayName());
setOwnerUuid(aPlayer.getUniqueID());
GT_Utility.sendSoundToPlayers(
- worldObj, SoundResource.RANDOM_CLICK, 1.0F, -1, xCoord, yCoord, zCoord);
+ worldObj,
+ SoundResource.RANDOM_CLICK,
+ 1.0F,
+ -1,
+ xCoord,
+ yCoord,
+ zCoord);
if (!aPlayer.capabilities.isCreativeMode) aPlayer.inventory.getCurrentItem().stackSize--;
}
return true;
@@ -1726,8 +1761,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
}
/**
- * returns all valid Inventory Slots, no matter which Side (Unless it's covered).
- * The Side Stuff is done in the following two Functions.
+ * returns all valid Inventory Slots, no matter which Side (Unless it's covered). The Side Stuff is done in the
+ * following two Functions.
*/
@Override
public int[] getAccessibleSlotsFromSide(int aSide) {
@@ -1742,8 +1777,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
*/
@Override
public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) {
- return canAccessData()
- && (mRunningThroughTick || !mInputDisabled)
+ return canAccessData() && (mRunningThroughTick || !mInputDisabled)
&& getCoverInfoAtSide((byte) aSide).letsItemsIn(aIndex)
&& mMetaTileEntity.canInsertItem(aIndex, aStack, aSide);
}
@@ -1753,15 +1787,13 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
*/
@Override
public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) {
- return canAccessData()
- && (mRunningThroughTick || !mOutputDisabled)
- && getCoverBehaviorAtSideNew((byte) aSide)
- .letsItemsOut(
- (byte) aSide,
- getCoverIDAtSide((byte) aSide),
- getComplexCoverDataAtSide((byte) aSide),
- aIndex,
- this)
+ return canAccessData() && (mRunningThroughTick || !mOutputDisabled)
+ && getCoverBehaviorAtSideNew((byte) aSide).letsItemsOut(
+ (byte) aSide,
+ getCoverIDAtSide((byte) aSide),
+ getComplexCoverDataAtSide((byte) aSide),
+ aIndex,
+ this)
&& mMetaTileEntity.canExtractItem(aIndex, aStack, aSide);
}
@@ -1915,13 +1947,13 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
@Override
public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) {
- if (!canAccessData()
- || !mMetaTileEntity.isElectric()
+ if (!canAccessData() || !mMetaTileEntity.isElectric()
|| !inputEnergyFrom(aSide)
|| aAmperage <= 0
|| aVoltage <= 0
|| getStoredEU() >= getEUCapacity()
- || mMetaTileEntity.maxAmperesIn() <= mAcceptedAmperes) return 0;
+ || mMetaTileEntity.maxAmperesIn() <= mAcceptedAmperes)
+ return 0;
if (aVoltage > getInputVoltage()) {
GT_Log.exp.println(
"Energy Explosion, injected " + aVoltage + "EU/t in a " + getInputVoltage() + "EU/t Machine!");
@@ -1929,12 +1961,11 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
return 0;
}
if (increaseStoredEnergyUnits(
- aVoltage
- * (aAmperage = Math.min(
- aAmperage,
- Math.min(
- mMetaTileEntity.maxAmperesIn() - mAcceptedAmperes,
- 1 + ((getEUCapacity() - getStoredEU()) / aVoltage)))),
+ aVoltage * (aAmperage = Math.min(
+ aAmperage,
+ Math.min(
+ mMetaTileEntity.maxAmperesIn() - mAcceptedAmperes,
+ 1 + ((getEUCapacity() - getStoredEU()) / aVoltage)))),
true)) {
mAverageEUInput[mAverageEUInputIndex] += aVoltage * aAmperage;
mAcceptedAmperes += aAmperage;
@@ -1945,10 +1976,10 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
@Override
public boolean drainEnergyUnits(byte aSide, long aVoltage, long aAmperage) {
- if (!canAccessData()
- || !mMetaTileEntity.isElectric()
+ if (!canAccessData() || !mMetaTileEntity.isElectric()
|| !outputsEnergyTo(aSide)
- || getStoredEU() - (aVoltage * aAmperage) < mMetaTileEntity.getMinimumStoredEU()) return false;
+ || getStoredEU() - (aVoltage * aAmperage) < mMetaTileEntity.getMinimumStoredEU())
+ return false;
if (decreaseStoredEU(aVoltage * aAmperage, false)) {
mAverageEUOutput[mAverageEUOutputIndex] += aVoltage * aAmperage;
return true;
@@ -1970,68 +2001,53 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
@Override
public int fill(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
- if (mTickTimer > 5
- && canAccessData()
+ if (mTickTimer > 5 && canAccessData()
&& (mRunningThroughTick || !mInputDisabled)
- && (aSide == ForgeDirection.UNKNOWN
- || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal())
- && getCoverInfoAtSide((byte) aSide.ordinal())
- .letsFluidIn(aFluid == null ? null : aFluid.getFluid()))))
+ && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal())
+ && getCoverInfoAtSide((byte) aSide.ordinal())
+ .letsFluidIn(aFluid == null ? null : aFluid.getFluid()))))
return mMetaTileEntity.fill(aSide, aFluid, doFill);
return 0;
}
@Override
public FluidStack drain(ForgeDirection aSide, int maxDrain, boolean doDrain) {
- if (mTickTimer > 5
- && canAccessData()
+ if (mTickTimer > 5 && canAccessData()
&& (mRunningThroughTick || !mOutputDisabled)
- && (aSide == ForgeDirection.UNKNOWN
- || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal())
- && getCoverInfoAtSide((byte) aSide.ordinal())
- .letsFluidOut(
- mMetaTileEntity.getFluid() == null
- ? null
- : mMetaTileEntity
- .getFluid()
- .getFluid()))))
+ && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal())
+ && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidOut(
+ mMetaTileEntity.getFluid() == null ? null : mMetaTileEntity.getFluid().getFluid()))))
return mMetaTileEntity.drain(aSide, maxDrain, doDrain);
return null;
}
@Override
public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) {
- if (mTickTimer > 5
- && canAccessData()
+ if (mTickTimer > 5 && canAccessData()
&& (mRunningThroughTick || !mOutputDisabled)
- && (aSide == ForgeDirection.UNKNOWN
- || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal())
- && getCoverInfoAtSide((byte) aSide.ordinal())
- .letsFluidOut(aFluid == null ? null : aFluid.getFluid()))))
+ && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal())
+ && getCoverInfoAtSide((byte) aSide.ordinal())
+ .letsFluidOut(aFluid == null ? null : aFluid.getFluid()))))
return mMetaTileEntity.drain(aSide, aFluid, doDrain);
return null;
}
@Override
public boolean canFill(ForgeDirection aSide, Fluid aFluid) {
- if (mTickTimer > 5
- && canAccessData()
+ if (mTickTimer > 5 && canAccessData()
&& (mRunningThroughTick || !mInputDisabled)
- && (aSide == ForgeDirection.UNKNOWN
- || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal())
- && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidIn(aFluid))))
+ && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal())
+ && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidIn(aFluid))))
return mMetaTileEntity.canFill(aSide, aFluid);
return false;
}
@Override
public boolean canDrain(ForgeDirection aSide, Fluid aFluid) {
- if (mTickTimer > 5
- && canAccessData()
+ if (mTickTimer > 5 && canAccessData()
&& (mRunningThroughTick || !mOutputDisabled)
- && (aSide == ForgeDirection.UNKNOWN
- || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal())
- && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidOut(aFluid))))
+ && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal())
+ && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidOut(aFluid))))
return mMetaTileEntity.canDrain(aSide, aFluid);
return false;
}
@@ -2040,12 +2056,9 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
public FluidTankInfo[] getTankInfo(ForgeDirection aSide) {
final byte tSide = (byte) aSide.ordinal();
- if (canAccessData()
- && (aSide == ForgeDirection.UNKNOWN
- || (mMetaTileEntity.isLiquidInput(tSide)
- && getCoverInfoAtSide(tSide).letsFluidIn(null))
- || (mMetaTileEntity.isLiquidOutput(tSide)
- && getCoverInfoAtSide(tSide).letsFluidOut(null))))
+ if (canAccessData() && (aSide == ForgeDirection.UNKNOWN
+ || (mMetaTileEntity.isLiquidInput(tSide) && getCoverInfoAtSide(tSide).letsFluidIn(null))
+ || (mMetaTileEntity.isLiquidOutput(tSide) && getCoverInfoAtSide(tSide).letsFluidOut(null))))
return mMetaTileEntity.getTankInfo(aSide);
return new FluidTankInfo[] {};
}
@@ -2157,9 +2170,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
return true;
}
aStack = GT_OreDictUnificator.get(aStack);
- if (GT_Utility.areStacksEqual(tStack, aStack)
- && tStack.stackSize + aStack.stackSize
- <= Math.min(aStack.getMaxStackSize(), getInventoryStackLimit())) {
+ if (GT_Utility.areStacksEqual(tStack, aStack) && tStack.stackSize + aStack.stackSize
+ <= Math.min(aStack.getMaxStackSize(), getInventoryStackLimit())) {
tStack.stackSize += aStack.stackSize;
markDirty();
return true;
@@ -2216,14 +2228,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
}
@Override
- public void addCollisionBoxesToList(
- World aWorld,
- int aX,
- int aY,
- int aZ,
- AxisAlignedBB inputAABB,
- List<AxisAlignedBB> outputAABB,
- Entity collider) {
+ public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB,
+ List<AxisAlignedBB> outputAABB, Entity collider) {
mMetaTileEntity.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider);
}
@@ -2238,9 +2244,9 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
}
/**
- * Shifts the machine Inventory index according to the change in Input/Output Slots.
- * This is NOT done automatically. If you want to change slot count for a machine this method needs to be adapted.
- * Currently this method only works for GT_MetaTileEntity_BasicMachine
+ * Shifts the machine Inventory index according to the change in Input/Output Slots. This is NOT done automatically.
+ * If you want to change slot count for a machine this method needs to be adapted. Currently this method only works
+ * for GT_MetaTileEntity_BasicMachine
*
* @param slotIndex The original Inventory index
* @param nbtVersion The GregTech version in which the original Inventory Index was saved.
@@ -2256,9 +2262,9 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
final int configCircuitAdditionVersion = GT_Mod.calculateTotalGTVersion(509, 40);
final int wireAdditionVersion = GT_Mod.calculateTotalGTVersion(509, 41);
// 4 is old GT_MetaTileEntity_BasicMachine.OTHER_SLOT_COUNT
- if (nbtVersion < configCircuitAdditionVersion
- && getMetaTileEntity() instanceof GT_MetaTileEntity_BasicMachine
- && slotIndex >= 4) slotIndex += 1;
+ if (nbtVersion < configCircuitAdditionVersion && getMetaTileEntity() instanceof GT_MetaTileEntity_BasicMachine
+ && slotIndex >= 4)
+ slotIndex += 1;
if (mID >= 211 && mID <= 218) { // Assembler
if (nbtVersion < chemistryUpdateVersion) {
oldInputSize = 2;
diff --git a/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java
index 23a247468a..31d388cf71 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java
@@ -7,6 +7,33 @@ import static gregtech.api.enums.GT_Values.NW;
import static gregtech.api.enums.GT_Values.SIDE_DOWN;
import static gregtech.api.enums.GT_Values.SIDE_UP;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.function.Supplier;
+
+import net.minecraft.block.Block;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ChunkCoordinates;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.chunk.Chunk;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.IFluidHandler;
+
import com.gtnewhorizons.modularui.api.drawable.IDrawable;
import com.gtnewhorizons.modularui.api.drawable.ItemDrawable;
import com.gtnewhorizons.modularui.api.forge.ItemStackHandler;
@@ -22,6 +49,7 @@ import com.gtnewhorizons.modularui.common.widget.MultiChildWidget;
import com.gtnewhorizons.modularui.common.widget.SlotGroup;
import com.gtnewhorizons.modularui.common.widget.SlotWidget;
import com.gtnewhorizons.modularui.common.widget.TextWidget;
+
import gregtech.GT_Mod;
import gregtech.api.enums.Dyes;
import gregtech.api.enums.GT_Values;
@@ -43,61 +71,33 @@ import gregtech.api.util.GT_Utility;
import gregtech.common.gui.modularui.uifactory.SelectItemUIFactory;
import ic2.api.energy.event.EnergyTileLoadEvent;
import ic2.api.energy.event.EnergyTileUnloadEvent;
-import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.ThreadLocalRandom;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.function.Supplier;
-import net.minecraft.block.Block;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Blocks;
-import net.minecraft.inventory.IInventory;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.ChunkCoordinates;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.util.MathHelper;
-import net.minecraft.util.StatCollector;
-import net.minecraft.world.World;
-import net.minecraft.world.biome.BiomeGenBase;
-import net.minecraft.world.chunk.Chunk;
-import net.minecraftforge.common.MinecraftForge;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.IFluidHandler;
/**
* The Functions my old TileEntities and my BaseMetaTileEntities have in common.
* <p/>
* Basically everything a TileEntity should have.
*/
-public abstract class BaseTileEntity extends TileEntity
- implements IHasWorldObjectAndCoords,
- IIC2Enet,
- IGTEnet,
- ITileWithModularUI,
- IAddGregtechLogo,
- IGetGUITextureSet,
- IAddInventorySlots {
+public abstract class BaseTileEntity extends TileEntity implements IHasWorldObjectAndCoords, IIC2Enet, IGTEnet,
+ ITileWithModularUI, IAddGregtechLogo, IGetGUITextureSet, IAddInventorySlots {
+
protected boolean mInventoryChanged = false;
/**
* Buffers adjacent TileEntities for faster access
* <p/>
- * "this" means that there is no TileEntity, while "null" means that it doesn't know if there is even a TileEntity and still needs to check that if needed.
+ * "this" means that there is no TileEntity, while "null" means that it doesn't know if there is even a TileEntity
+ * and still needs to check that if needed.
*/
private final TileEntity[] mBufferedTileEntities = new TileEntity[6];
/**
- * If this TileEntity checks for the Chunk to be loaded before returning World based values.
- * The AdvPump hacks this to false to ensure everything runs properly even when far Chunks are not actively loaded.
- * But anything else should not cause worfin' Chunks, uhh I mean orphan Chunks.
+ * If this TileEntity checks for the Chunk to be loaded before returning World based values. The AdvPump hacks this
+ * to false to ensure everything runs properly even when far Chunks are not actively loaded. But anything else
+ * should not cause worfin' Chunks, uhh I mean orphan Chunks.
*/
public boolean ignoreUnloadedChunks = true;
/**
- * This Variable checks if this TileEntity is dead, because Minecraft is too stupid to have proper TileEntity unloading.
+ * This Variable checks if this TileEntity is dead, because Minecraft is too stupid to have proper TileEntity
+ * unloading.
*/
public boolean isDead = false;
@@ -107,8 +107,8 @@ public abstract class BaseTileEntity extends TileEntity
if (aPlayer != null) {
if (aPlayer.rotationPitch >= 65 && aAllowedFacings[SIDE_UP]) return SIDE_UP;
if (aPlayer.rotationPitch <= -65 && aAllowedFacings[SIDE_DOWN]) return SIDE_DOWN;
- final byte rFacing =
- COMPASS_DIRECTIONS[MathHelper.floor_double(0.5D + 4.0F * aPlayer.rotationYaw / 360.0F) & 0x3];
+ final byte rFacing = COMPASS_DIRECTIONS[MathHelper.floor_double(0.5D + 4.0F * aPlayer.rotationYaw / 360.0F)
+ & 0x3];
if (aAllowedFacings[rFacing]) return rFacing;
}
for (final byte tSide : ALL_VALID_SIDES) if (aAllowedFacings[tSide]) return tSide;
@@ -407,9 +407,9 @@ public abstract class BaseTileEntity extends TileEntity
public Block getBlock(ChunkCoordinates aCoords) {
if (worldObj == null) return Blocks.air;
- if (ignoreUnloadedChunks
- && crossedChunkBorder(aCoords)
- && !worldObj.blockExists(aCoords.posX, aCoords.posY, aCoords.posZ)) return Blocks.air;
+ if (ignoreUnloadedChunks && crossedChunkBorder(aCoords)
+ && !worldObj.blockExists(aCoords.posX, aCoords.posY, aCoords.posZ))
+ return Blocks.air;
return worldObj.getBlock(aCoords.posX, aCoords.posY, aCoords.posZ);
}
@@ -471,8 +471,7 @@ public abstract class BaseTileEntity extends TileEntity
mBufferedTileEntities[aSide] = null;
return getTileEntityAtSide(aSide);
}
- if (mBufferedTileEntities[aSide].xCoord == tX
- && mBufferedTileEntities[aSide].yCoord == tY
+ if (mBufferedTileEntities[aSide].xCoord == tX && mBufferedTileEntities[aSide].yCoord == tY
&& mBufferedTileEntities[aSide].zCoord == tZ) {
return mBufferedTileEntities[aSide];
}
@@ -531,8 +530,8 @@ public abstract class BaseTileEntity extends TileEntity
// update if it was / is strong powered.
if (((((mStrongRedstone | oStrongRedstone) >>> dir.ordinal()) & 1) != 0)
&& getBlock(x1, y1, z1).isNormalCube()) {
- final int skipUpdateSide = dir.getOpposite()
- .ordinal(); // Don't update this block. Still updates diagonal blocks twice if conditions
+ final int skipUpdateSide = dir.getOpposite().ordinal(); // Don't update this block. Still updates
+ // diagonal blocks twice if conditions
// meet.
for (final ForgeDirection dir2 : ForgeDirection.VALID_DIRECTIONS) {
@@ -548,7 +547,10 @@ public abstract class BaseTileEntity extends TileEntity
@Override
public final void sendBlockEvent(byte aID, byte aValue) {
NW.sendPacketToAllPlayersInRange(
- worldObj, new GT_Packet_Block_Event(xCoord, (short) yCoord, zCoord, aID, aValue), xCoord, zCoord);
+ worldObj,
+ new GT_Packet_Block_Event(xCoord, (short) yCoord, zCoord, aID, aValue),
+ xCoord,
+ zCoord);
}
protected boolean crossedChunkBorder(int aX, int aZ) {
@@ -679,8 +681,7 @@ public abstract class BaseTileEntity extends TileEntity
public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) {}
public void bindPlayerInventoryUI(ModularWindow.Builder builder, UIBuildContext buildContext) {
- builder.bindPlayerInventory(
- buildContext.getPlayer(), 7, getGUITextureSet().getItemSlot());
+ builder.bindPlayerInventory(buildContext.getPlayer(), 7, getGUITextureSet().getItemSlot());
}
public String getLocalName() {
@@ -705,29 +706,24 @@ public abstract class BaseTileEntity extends TileEntity
int titleWidth = 0, titleHeight = 0;
if (NetworkUtils.isClient()) {
final FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
- //noinspection unchecked
- final List<String> titleLines =
- fontRenderer.listFormattedStringToWidth(title, getGUIWidth() - (TAB_PADDING + TITLE_PADDING) * 2);
- titleWidth = titleLines.size() > 1
- ? getGUIWidth() - (TAB_PADDING + TITLE_PADDING) * 2
+ // noinspection unchecked
+ final List<String> titleLines = fontRenderer
+ .listFormattedStringToWidth(title, getGUIWidth() - (TAB_PADDING + TITLE_PADDING) * 2);
+ titleWidth = titleLines.size() > 1 ? getGUIWidth() - (TAB_PADDING + TITLE_PADDING) * 2
: fontRenderer.getStringWidth(title);
- //noinspection PointlessArithmeticExpression
+ // noinspection PointlessArithmeticExpression
titleHeight = titleLines.size() * fontRenderer.FONT_HEIGHT + (titleLines.size() - 1) * 1;
}
final DrawableWidget tab = new DrawableWidget();
- final TextWidget text = new TextWidget(title)
- .setDefaultColor(getTitleColor())
- .setTextAlignment(Alignment.CenterLeft)
- .setMaxWidth(titleWidth);
+ final TextWidget text = new TextWidget(title).setDefaultColor(getTitleColor())
+ .setTextAlignment(Alignment.CenterLeft).setMaxWidth(titleWidth);
if (GT_Mod.gregtechproxy.mTitleTabStyle == 1) {
- tab.setDrawable(getGUITextureSet().getTitleTabAngular())
- .setPos(0, -(titleHeight + TAB_PADDING) + 1)
+ tab.setDrawable(getGUITextureSet().getTitleTabAngular()).setPos(0, -(titleHeight + TAB_PADDING) + 1)
.setSize(getGUIWidth(), titleHeight + TAB_PADDING * 2);
text.setPos(TAB_PADDING + TITLE_PADDING, -titleHeight + TAB_PADDING);
} else {
- tab.setDrawable(getGUITextureSet().getTitleTabDark())
- .setPos(0, -(titleHeight + TAB_PADDING * 2) + 1)
+ tab.setDrawable(getGUITextureSet().getTitleTabDark()).setPos(0, -(titleHeight + TAB_PADDING * 2) + 1)
.setSize(titleWidth + (TAB_PADDING + TITLE_PADDING) * 2, titleHeight + TAB_PADDING * 2 - 1);
text.setPos(TAB_PADDING + TITLE_PADDING, -titleHeight);
}
@@ -735,15 +731,13 @@ public abstract class BaseTileEntity extends TileEntity
}
protected void addTitleItemIconStyle(ModularWindow.Builder builder, String title) {
- builder.widget(new MultiChildWidget()
- .addChild(new DrawableWidget()
- .setDrawable(getGUITextureSet().getTitleTabNormal())
- .setPos(0, 0)
- .setSize(24, 24))
- .addChild(new ItemDrawable(getStackForm(1)).asWidget().setPos(4, 4))
- .addTooltip(title)
- .setTooltipShowUpDelay(TOOLTIP_DELAY)
- .setPos(0, -24 + 3));
+ builder.widget(
+ new MultiChildWidget()
+ .addChild(
+ new DrawableWidget().setDrawable(getGUITextureSet().getTitleTabNormal()).setPos(0, 0)
+ .setSize(24, 24))
+ .addChild(new ItemDrawable(getStackForm(1)).asWidget().setPos(4, 4)).addTooltip(title)
+ .setTooltipShowUpDelay(TOOLTIP_DELAY).setPos(0, -24 + 3));
}
@Override
@@ -757,10 +751,8 @@ public abstract class BaseTileEntity extends TileEntity
@Override
public void addGregTechLogo(ModularWindow.Builder builder) {
- builder.widget(new DrawableWidget()
- .setDrawable(getGUITextureSet().getGregTechLogo())
- .setSize(17, 17)
- .setPos(152, 63));
+ builder.widget(
+ new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()).setSize(17, 17).setPos(152, 63));
}
protected int getGUIWidth() {
@@ -781,14 +773,11 @@ public abstract class BaseTileEntity extends TileEntity
if (inventoryHandler == null) return;
if (background.length == 0) {
- background = new IDrawable[] {getGUITextureSet().getItemSlot()};
+ background = new IDrawable[] { getGUITextureSet().getItemSlot() };
}
- builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 1)
- .startFromSlot(0)
- .endAtSlot(0)
- .background(background)
- .build()
- .setPos(79, 34));
+ builder.widget(
+ SlotGroup.ofItemHandler(inventoryHandler, 1).startFromSlot(0).endAtSlot(0).background(background)
+ .build().setPos(79, 34));
}
@Override
@@ -797,14 +786,11 @@ public abstract class BaseTileEntity extends TileEntity
if (inventoryHandler == null) return;
if (background.length == 0) {
- background = new IDrawable[] {getGUITextureSet().getItemSlot()};
+ background = new IDrawable[] { getGUITextureSet().getItemSlot() };
}
- builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 2)
- .startFromSlot(0)
- .endAtSlot(3)
- .background(background)
- .build()
- .setPos(70, 25));
+ builder.widget(
+ SlotGroup.ofItemHandler(inventoryHandler, 2).startFromSlot(0).endAtSlot(3).background(background)
+ .build().setPos(70, 25));
}
@Override
@@ -813,14 +799,11 @@ public abstract class BaseTileEntity extends TileEntity
if (inventoryHandler == null) return;
if (background.length == 0) {
- background = new IDrawable[] {getGUITextureSet().getItemSlot()};
+ background = new IDrawable[] { getGUITextureSet().getItemSlot() };
}
- builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 3)
- .startFromSlot(0)
- .endAtSlot(8)
- .background(background)
- .build()
- .setPos(61, 16));
+ builder.widget(
+ SlotGroup.ofItemHandler(inventoryHandler, 3).startFromSlot(0).endAtSlot(8).background(background)
+ .build().setPos(61, 16));
}
@Override
@@ -829,14 +812,11 @@ public abstract class BaseTileEntity extends TileEntity
if (inventoryHandler == null) return;
if (background.length == 0) {
- background = new IDrawable[] {getGUITextureSet().getItemSlot()};
+ background = new IDrawable[] { getGUITextureSet().getItemSlot() };
}
- builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 4)
- .startFromSlot(0)
- .endAtSlot(15)
- .background(background)
- .build()
- .setPos(52, 7));
+ builder.widget(
+ SlotGroup.ofItemHandler(inventoryHandler, 4).startFromSlot(0).endAtSlot(15).background(background)
+ .build().setPos(52, 7));
}
public void addCoverTabs(ModularWindow.Builder builder, UIBuildContext buildContext) {
@@ -859,76 +839,65 @@ public abstract class BaseTileEntity extends TileEntity
if (ccs == null) return;
final AtomicBoolean dialogOpened = new AtomicBoolean(false);
- builder.widget(
- new SlotWidget(new BaseSlot(inventoryHandler, ccs.getCircuitSlot(), true)) {
- @Override
- protected void phantomClick(ClickData clickData, ItemStack cursorStack) {
- final ItemStack newCircuit;
- if (clickData.shift) {
- if (clickData.mouseButton == 0) {
- if (NetworkUtils.isClient() && !dialogOpened.get()) {
- openSelectCircuitDialog(getContext(), dialogOpened);
- }
- return;
- } else {
- newCircuit = null;
- }
+ builder.widget(new SlotWidget(new BaseSlot(inventoryHandler, ccs.getCircuitSlot(), true)) {
+
+ @Override
+ protected void phantomClick(ClickData clickData, ItemStack cursorStack) {
+ final ItemStack newCircuit;
+ if (clickData.shift) {
+ if (clickData.mouseButton == 0) {
+ if (NetworkUtils.isClient() && !dialogOpened.get()) {
+ openSelectCircuitDialog(getContext(), dialogOpened);
+ }
+ return;
+ } else {
+ newCircuit = null;
+ }
+ } else {
+ final List<ItemStack> tCircuits = ccs.getConfigurationCircuits();
+ final int index = GT_Utility.findMatchingStackInList(tCircuits, cursorStack);
+ if (index < 0) {
+ int curIndex = GT_Utility
+ .findMatchingStackInList(tCircuits, inv.getStackInSlot(ccs.getCircuitSlot())) + 1;
+ if (clickData.mouseButton == 0) {
+ curIndex += 1;
} else {
- final List<ItemStack> tCircuits = ccs.getConfigurationCircuits();
- final int index = GT_Utility.findMatchingStackInList(tCircuits, cursorStack);
- if (index < 0) {
- int curIndex = GT_Utility.findMatchingStackInList(
- tCircuits, inv.getStackInSlot(ccs.getCircuitSlot()))
- + 1;
- if (clickData.mouseButton == 0) {
- curIndex += 1;
- } else {
- curIndex -= 1;
- }
- curIndex = Math.floorMod(curIndex, tCircuits.size() + 1) - 1;
- newCircuit = curIndex < 0 ? null : tCircuits.get(curIndex);
- } else {
- // set to whatever it is
- newCircuit = tCircuits.get(index);
- }
+ curIndex -= 1;
}
- inv.setInventorySlotContents(ccs.getCircuitSlot(), newCircuit);
+ curIndex = Math.floorMod(curIndex, tCircuits.size() + 1) - 1;
+ newCircuit = curIndex < 0 ? null : tCircuits.get(curIndex);
+ } else {
+ // set to whatever it is
+ newCircuit = tCircuits.get(index);
}
+ }
+ inv.setInventorySlotContents(ccs.getCircuitSlot(), newCircuit);
+ }
- @Override
- protected void phantomScroll(int direction) {
- phantomClick(new ClickData(direction > 0 ? 1 : 0, false, false, false));
- }
+ @Override
+ protected void phantomScroll(int direction) {
+ phantomClick(new ClickData(direction > 0 ? 1 : 0, false, false, false));
+ }
- @Override
- public List<String> getExtraTooltip() {
- return Arrays.asList(
- EnumChatFormatting.DARK_GRAY
- + EnumChatFormatting.getTextWithoutFormattingCodes(
- StatCollector.translateToLocal(
- "GT5U.machines.select_circuit.tooltip.1")),
- EnumChatFormatting.DARK_GRAY
- + EnumChatFormatting.getTextWithoutFormattingCodes(
- StatCollector.translateToLocal(
- "GT5U.machines.select_circuit.tooltip.2")),
- EnumChatFormatting.DARK_GRAY
- + EnumChatFormatting.getTextWithoutFormattingCodes(
- StatCollector.translateToLocal(
- "GT5U.machines.select_circuit.tooltip.3")));
- }
- }.setOverwriteItemStackTooltip(list -> {
- list.removeIf(line ->
- line.contains(StatCollector.translateToLocal("gt.integrated_circuit.tooltip.0"))
- || line.contains(
- StatCollector.translateToLocal("gt.integrated_circuit.tooltip.1")));
- return list;
- })
- .disableShiftInsert()
- .setHandlePhantomActionClient(true)
- .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_INT_CIRCUIT)
- .setGTTooltip(() -> mTooltipCache.getData("GT5U.machines.select_circuit.tooltip"))
- .setTooltipShowUpDelay(TOOLTIP_DELAY)
- .setPos(ccs.getCircuitSlotX() - 1, ccs.getCircuitSlotY() - 1));
+ @Override
+ public List<String> getExtraTooltip() {
+ return Arrays.asList(
+ EnumChatFormatting.DARK_GRAY + EnumChatFormatting.getTextWithoutFormattingCodes(
+ StatCollector.translateToLocal("GT5U.machines.select_circuit.tooltip.1")),
+ EnumChatFormatting.DARK_GRAY + EnumChatFormatting.getTextWithoutFormattingCodes(
+ StatCollector.translateToLocal("GT5U.machines.select_circuit.tooltip.2")),
+ EnumChatFormatting.DARK_GRAY + EnumChatFormatting.getTextWithoutFormattingCodes(
+ StatCollector.translateToLocal("GT5U.machines.select_circuit.tooltip.3")));
+ }
+ }.setOverwriteItemStackTooltip(list -> {
+ list.removeIf(
+ line -> line.contains(StatCollector.translateToLocal("gt.integrated_circuit.tooltip.0"))
+ || line.contains(StatCollector.translateToLocal("gt.integrated_circuit.tooltip.1")));
+ return list;
+ }).disableShiftInsert().setHandlePhantomActionClient(true)
+ .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_INT_CIRCUIT)
+ .setGTTooltip(() -> mTooltipCache.getData("GT5U.machines.select_circuit.tooltip"))
+ .setTooltipShowUpDelay(TOOLTIP_DELAY).setPos(ccs.getCircuitSlotX() - 1, ccs.getCircuitSlotY() - 1));
}
protected void openSelectCircuitDialog(ModularUIContext uiContext, AtomicBoolean dialogOpened) {
@@ -939,16 +908,16 @@ public abstract class BaseTileEntity extends TileEntity
final IInventory inv = (IInventory) this;
final List<ItemStack> circuits = ccs.getConfigurationCircuits();
- uiContext.openClientWindow(player -> new SelectItemUIFactory(
+ uiContext.openClientWindow(
+ player -> new SelectItemUIFactory(
StatCollector.translateToLocal("GT5U.machines.select_circuit"),
getStackForm(0),
this::onCircuitSelected,
circuits,
GT_Utility.findMatchingStackInList(circuits, inv.getStackInSlot(ccs.getCircuitSlot())))
- .setAnotherWindow(true, dialogOpened)
- .setGuiTint(getGUIColorization())
- .setCurrentGetter(() -> inv.getStackInSlot(ccs.getCircuitSlot()))
- .createWindow(new UIBuildContext(player)));
+ .setAnotherWindow(true, dialogOpened).setGuiTint(getGUIColorization())
+ .setCurrentGetter(() -> inv.getStackInSlot(ccs.getCircuitSlot()))
+ .createWindow(new UIBuildContext(player)));
}
protected void onCircuitSelected(ItemStack selected) {
diff --git a/src/main/java/gregtech/api/metatileentity/CommonMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/CommonMetaTileEntity.java
index e2860d6292..a49071cdcf 100644
--- a/src/main/java/gregtech/api/metatileentity/CommonMetaTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/CommonMetaTileEntity.java
@@ -2,9 +2,15 @@ package gregtech.api.metatileentity;
import static gregtech.GT_Mod.GT_FML_LOGGER;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.network.Packet;
+
import com.gtnewhorizons.modularui.api.forge.ItemStackHandler;
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
+
import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.gui.modularui.GUITextureSet;
@@ -18,12 +24,9 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_Utility;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.nbt.NBTTagList;
-import net.minecraft.network.Packet;
public abstract class CommonMetaTileEntity extends CoverableTileEntity implements IGregTechTileEntity {
+
protected boolean mNeedsBlockUpdate = true, mNeedsUpdate = true, mSendClientData = false, mInventoryChanged = false;
protected boolean createNewMetatileEntity(short aID) {
@@ -89,8 +92,8 @@ public abstract class CommonMetaTileEntity extends CoverableTileEntity implement
}
/**
- * Shifts the machine Inventory index according to the change in Input/Output Slots.
- * Default implementation does not do anything to the slotIndex.
+ * Shifts the machine Inventory index according to the change in Input/Output Slots. Default implementation does not
+ * do anything to the slotIndex.
*/
protected int migrateInventoryIndex(int slotIndex, int nbtVersion) {
return slotIndex;
diff --git a/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java b/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java
index 69f51730f4..5b469ddb00 100644
--- a/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java
@@ -6,6 +6,30 @@ import static gregtech.api.enums.GT_Values.NW;
import static gregtech.api.util.GT_LanguageManager.FACES;
import static gregtech.api.util.GT_LanguageManager.getTranslation;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.IntStream;
+
+import mcp.mobius.waila.api.IWailaConfigHandler;
+import mcp.mobius.waila.api.IWailaDataAccessor;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidRegistry;
+
import com.gtnewhorizons.modularui.api.drawable.IDrawable;
import com.gtnewhorizons.modularui.api.drawable.ItemDrawable;
import com.gtnewhorizons.modularui.api.math.MainAxisAlignment;
@@ -15,6 +39,7 @@ import com.gtnewhorizons.modularui.api.widget.Widget;
import com.gtnewhorizons.modularui.common.widget.ButtonWidget;
import com.gtnewhorizons.modularui.common.widget.Column;
import com.gtnewhorizons.modularui.common.widget.MultiChildWidget;
+
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.GT_Mod;
@@ -35,60 +60,33 @@ import gregtech.api.util.ISerializableObject;
import gregtech.common.GT_Client;
import gregtech.common.covers.CoverInfo;
import gregtech.common.covers.GT_Cover_Fluidfilter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-import java.util.stream.IntStream;
-import mcp.mobius.waila.api.IWailaConfigHandler;
-import mcp.mobius.waila.api.IWailaDataAccessor;
-import net.minecraft.client.Minecraft;
-import net.minecraft.entity.item.EntityItem;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.nbt.NBTTagList;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.util.StatCollector;
-import net.minecraft.world.World;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.FluidRegistry;
public abstract class CoverableTileEntity extends BaseTileEntity implements ICoverable, IGregtechWailaProvider {
+
public static final String[] COVER_DATA_NBT_KEYS = Arrays.stream(ForgeDirection.VALID_DIRECTIONS)
- .mapToInt(Enum::ordinal)
- .mapToObj(i -> "mCoverData" + i)
- .toArray(String[]::new);
+ .mapToInt(Enum::ordinal).mapToObj(i -> "mCoverData" + i).toArray(String[]::new);
// New Cover Information
- protected final CoverInfo[] coverInfos = new CoverInfo[] {null, null, null, null, null, null};
+ protected final CoverInfo[] coverInfos = new CoverInfo[] { null, null, null, null, null, null };
- protected byte[] mSidedRedstone = new byte[] {15, 15, 15, 15, 15, 15};
+ protected byte[] mSidedRedstone = new byte[] { 15, 15, 15, 15, 15, 15 };
protected boolean mRedstone = false;
protected byte mStrongRedstone = 0;
/* Deprecated Cover Variables */
@Deprecated
protected final GT_CoverBehaviorBase<?>[] mCoverBehaviors = new GT_CoverBehaviorBase<?>[] {
- GregTech_API.sNoBehavior,
- GregTech_API.sNoBehavior,
- GregTech_API.sNoBehavior,
- GregTech_API.sNoBehavior,
- GregTech_API.sNoBehavior,
- GregTech_API.sNoBehavior
- };
+ GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior,
+ GregTech_API.sNoBehavior, GregTech_API.sNoBehavior };
@Deprecated
- protected int[] mCoverSides = new int[] {0, 0, 0, 0, 0, 0};
+ protected int[] mCoverSides = new int[] { 0, 0, 0, 0, 0, 0 };
@Deprecated
protected ISerializableObject[] mCoverData = new ISerializableObject[6];
@Deprecated
- protected final boolean[] mCoverNeedUpdate = new boolean[] {false, false, false, false, false, false};
+ protected final boolean[] mCoverNeedUpdate = new boolean[] { false, false, false, false, false, false };
/* End Deprecated Cover Variables */
protected short mID = 0;
@@ -96,7 +94,7 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov
protected void writeCoverNBT(NBTTagCompound aNBT, boolean isDrop) {
final NBTTagList tList = new NBTTagList();
- final int[] coverSides = new int[] {0, 0, 0, 0, 0, 0};
+ final int[] coverSides = new int[] { 0, 0, 0, 0, 0, 0 };
for (byte i = 0; i < coverInfos.length; i++) {
final CoverInfo coverInfo = getCoverInfoAtSide(i);
@@ -122,9 +120,8 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov
protected void readCoverNBT(NBTTagCompound aNBT) {
mRedstone = aNBT.getBoolean("mRedstone");
- mSidedRedstone = aNBT.hasKey("mRedstoneSided")
- ? aNBT.getByteArray("mRedstoneSided")
- : new byte[] {15, 15, 15, 15, 15, 15};
+ mSidedRedstone = aNBT.hasKey("mRedstoneSided") ? aNBT.getByteArray("mRedstoneSided")
+ : new byte[] { 15, 15, 15, 15, 15, 15 };
mStrongRedstone = aNBT.getByte("mStrongRedstone");
if (aNBT.hasKey(GT_Values.NBT.COVERS)) {
@@ -145,8 +142,8 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov
}
public void readLegacyCoverInfoNBT(NBTTagCompound aNBT) {
- final int[] coverIDs =
- aNBT.hasKey("mCoverSides") ? aNBT.getIntArray("mCoverSides") : new int[] {0, 0, 0, 0, 0, 0};
+ final int[] coverIDs = aNBT.hasKey("mCoverSides") ? aNBT.getIntArray("mCoverSides")
+ : new int[] { 0, 0, 0, 0, 0, 0 };
final boolean hasOldCoverData = (aNBT.hasKey("mCoverData", 11) && aNBT.getIntArray("mCoverData").length == 6);
final int[] tOldData = hasOldCoverData ? aNBT.getIntArray("mCoverData") : new int[] {};
@@ -162,10 +159,8 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov
if (coverBehavior instanceof GT_Cover_Fluidfilter) {
final String filterKey = String.format("fluidFilter%d", i);
if (aNBT.hasKey(filterKey)) {
- coverData = coverInfo
- .getCoverBehavior()
- .createDataObject(
- (tOldData[i] & 7) | (FluidRegistry.getFluidID(aNBT.getString(filterKey)) << 3));
+ coverData = coverInfo.getCoverBehavior().createDataObject(
+ (tOldData[i] & 7) | (FluidRegistry.getFluidID(aNBT.getString(filterKey)) << 3));
}
} else {
coverData = coverBehavior.createDataObject(tOldData[i]);
@@ -241,12 +236,10 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov
if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x1) != 0) {
return Textures.BlockIcons.HIDDEN_TEXTURE[0]; // See through
}
- final ITexture coverTexture = (!(this instanceof BaseMetaPipeEntity))
- ? coverInfo.getSpecialCoverFGTexture()
+ final ITexture coverTexture = (!(this instanceof BaseMetaPipeEntity)) ? coverInfo.getSpecialCoverFGTexture()
: coverInfo.getSpecialCoverTexture();
- return coverTexture != null
- ? coverTexture
+ return coverTexture != null ? coverTexture
: GregTech_API.sCovers.get(new GT_ItemStack(getCoverIDAtSide(aSide)));
}
@@ -438,16 +431,12 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov
@Override
public byte getStrongestRedstone() {
- return (byte) IntStream.range(1, 6)
- .map(i -> getInternalInputRedstoneSignal((byte) i))
- .max()
- .orElse(0);
+ return (byte) IntStream.range(1, 6).map(i -> getInternalInputRedstoneSignal((byte) i)).max().orElse(0);
}
@Override
public byte getStrongOutputRedstoneSignal(byte aSide) {
- return aSide >= 0 && aSide < 6 && (mStrongRedstone & (1 << aSide)) != 0
- ? (byte) (mSidedRedstone[aSide] & 15)
+ return aSide >= 0 && aSide < 6 && (mStrongRedstone & (1 << aSide)) != 0 ? (byte) (mSidedRedstone[aSide] & 15)
: 0;
}
@@ -458,30 +447,26 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov
@Override
public byte getInternalInputRedstoneSignal(byte aSide) {
- return (byte) (getCoverBehaviorAtSideNew(aSide)
- .getRedstoneInput(
- aSide,
- getInputRedstoneSignal(aSide),
- getCoverIDAtSide(aSide),
- getComplexCoverDataAtSide(aSide),
- this)
- & 15);
+ return (byte) (getCoverBehaviorAtSideNew(aSide).getRedstoneInput(
+ aSide,
+ getInputRedstoneSignal(aSide),
+ getCoverIDAtSide(aSide),
+ getComplexCoverDataAtSide(aSide),
+ this) & 15);
}
@Override
public byte getInputRedstoneSignal(byte aSide) {
- return (byte) (worldObj.getIndirectPowerLevelTo(
- getOffsetX(aSide, 1), getOffsetY(aSide, 1), getOffsetZ(aSide, 1), aSide)
- & 15);
+ return (byte) (worldObj
+ .getIndirectPowerLevelTo(getOffsetX(aSide, 1), getOffsetY(aSide, 1), getOffsetZ(aSide, 1), aSide) & 15);
}
@Override
public byte getOutputRedstoneSignal(byte aSide) {
return getCoverBehaviorAtSideNew(aSide)
- .manipulatesSidedRedstoneOutput(
- aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this)
- ? mSidedRedstone[aSide]
- : getGeneralRS(aSide);
+ .manipulatesSidedRedstoneOutput(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this)
+ ? mSidedRedstone[aSide]
+ : getGeneralRS(aSide);
}
protected void updateOutputRedstoneSignal(byte aSide) {
@@ -499,8 +484,8 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov
}
@Override
- public void receiveCoverData(
- byte aCoverSide, int aCoverID, ISerializableObject aCoverData, EntityPlayerMP aPlayer) {
+ public void receiveCoverData(byte aCoverSide, int aCoverID, ISerializableObject aCoverData,
+ EntityPlayerMP aPlayer) {
if (aCoverSide < 0 || aCoverSide >= 6) return;
final CoverInfo oldCoverInfo = getCoverInfoAtSide(aCoverSide);
@@ -521,15 +506,18 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov
final CoverInfo coverInfo = getCoverInfoAtSide(i);
if (coverInfo.needsUpdate()) {
NW.sendPacketToAllPlayersInRange(
- worldObj, new GT_Packet_SendCoverData(coverInfo, this), xCoord, zCoord);
+ worldObj,
+ new GT_Packet_SendCoverData(coverInfo, this),
+ xCoord,
+ zCoord);
coverInfo.setNeedsUpdate(false);
}
}
}
@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 byte currentFacing = (byte) accessor.getSide().ordinal();
@@ -541,15 +529,15 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov
final ItemStack coverStack = coverInfo.getDisplayStack();
if (coverStack != null) {
- currenttip.add(StatCollector.translateToLocalFormatted(
- "GT5U.waila.cover",
- currentFacing == coverInfo.getSide()
- ? StatCollector.translateToLocal("GT5U.waila.cover.current_facing")
- : StatCollector.translateToLocal("GT5U.interface.coverTabs."
- + ForgeDirection.getOrientation(coverInfo.getSide())
- .toString()
- .toLowerCase()),
- coverStack.getDisplayName()));
+ currenttip.add(
+ StatCollector.translateToLocalFormatted(
+ "GT5U.waila.cover",
+ currentFacing == coverInfo.getSide()
+ ? StatCollector.translateToLocal("GT5U.waila.cover.current_facing")
+ : StatCollector.translateToLocal(
+ "GT5U.interface.coverTabs." + ForgeDirection
+ .getOrientation(coverInfo.getSide()).toString().toLowerCase()),
+ coverStack.getDisplayName()));
final String behaviorDesc = coverInfo.getBehaviorDescription();
if (!Objects.equals(behaviorDesc, E)) currenttip.add(behaviorDesc);
}
@@ -560,8 +548,8 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov
}
@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) {
// No super implementation
// super.getWailaNBTData(player, tile, tag, world, x, y, z);
@@ -572,7 +560,8 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov
/**
* Add installed cover information, generally called from ItemBlock
- * @param aNBT - NBTTagCompound from the stack
+ *
+ * @param aNBT - NBTTagCompound from the stack
* @param aList - List to add the information to
*/
public static void addInstalledCoversInformation(NBTTagCompound aNBT, List<String> aList) {
@@ -584,9 +573,11 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov
final ItemStack coverStack = coverInfo.getDisplayStack();
if (coverStack != null) {
- aList.add(String.format(
- "Cover on %s side: %s",
- getTranslation(FACES[coverInfo.getSide()]), coverStack.getDisplayName()));
+ aList.add(
+ String.format(
+ "Cover on %s side: %s",
+ getTranslation(FACES[coverInfo.getSide()]),
+ coverStack.getDisplayName()));
}
}
@@ -599,12 +590,15 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov
final GT_CoverBehaviorBase<?> behavior = GregTech_API.getCoverBehaviorNew(coverId);
if (behavior == null || behavior == GregTech_API.sNoBehavior) continue;
if (!aNBT.hasKey(CoverableTileEntity.COVER_DATA_NBT_KEYS[tSide])) continue;
- final ISerializableObject dataObject =
- behavior.createDataObject(aNBT.getTag(CoverableTileEntity.COVER_DATA_NBT_KEYS[tSide]));
+ final ISerializableObject dataObject = behavior
+ .createDataObject(aNBT.getTag(CoverableTileEntity.COVER_DATA_NBT_KEYS[tSide]));
final ItemStack coverStack = behavior.getDisplayStack(coverId, dataObject);
if (coverStack != null) {
- aList.add(String.format(
- "Cover on %s side: %s", getTranslation(FACES[tSide]), coverStack.getDisplayName()));
+ aList.add(
+ String.format(
+ "Cover on %s side: %s",
+ getTranslation(FACES[tSide]),
+ coverStack.getDisplayName()));
}
}
}
@@ -619,20 +613,16 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov
@Override
public void addCoverTabs(ModularWindow.Builder builder, UIBuildContext buildContext) {
- final int COVER_TAB_LEFT = -16,
- COVER_TAB_TOP = 1,
- COVER_TAB_HEIGHT = 20,
- COVER_TAB_WIDTH = 18,
- COVER_TAB_SPACING = 2,
- ICON_SIZE = 16;
+ final int COVER_TAB_LEFT = -16, COVER_TAB_TOP = 1, COVER_TAB_HEIGHT = 20, COVER_TAB_WIDTH = 18,
+ COVER_TAB_SPACING = 2, ICON_SIZE = 16;
final boolean flipHorizontally = GT_Mod.gregtechproxy.mCoverTabsFlipped;
final Column columnWidget = new Column();
builder.widget(columnWidget);
final int xPos = flipHorizontally ? (getGUIWidth() - COVER_TAB_LEFT - COVER_TAB_WIDTH) : COVER_TAB_LEFT;
if (GT_Mod.gregtechproxy.mCoverTabsVisible) {
- columnWidget.setPos(xPos, COVER_TAB_TOP).setEnabled(widget -> ((Column) widget)
- .getChildren().stream().anyMatch(Widget::isEnabled));
+ columnWidget.setPos(xPos, COVER_TAB_TOP)
+ .setEnabled(widget -> ((Column) widget).getChildren().stream().anyMatch(Widget::isEnabled));
} else {
columnWidget.setEnabled(false);
}
@@ -641,42 +631,34 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
final byte side = (byte) direction.ordinal();
buildContext.addSyncedWindow(side + COVER_WINDOW_ID_START, player -> createCoverWindow(player, side));
- columnWidget.addChild(new MultiChildWidget()
+ columnWidget.addChild(new MultiChildWidget().addChild(new ButtonWidget() {
+
+ @Override
+ public IDrawable[] getBackground() {
+ final List<IDrawable> backgrounds = new ArrayList<>();
+ final GUITextureSet tabIconSet = getGUITextureSet();
+
+ if (getCoverBehaviorAtSideNew(side).hasCoverGUI()) {
+ if (isHovering()) {
+ backgrounds.add(
+ flipHorizontally ? tabIconSet.getCoverTabHighlightFlipped()
+ : tabIconSet.getCoverTabHighlight());
+ } else {
+ backgrounds.add(
+ flipHorizontally ? tabIconSet.getCoverTabNormalFlipped()
+ : tabIconSet.getCoverTabNormal());
+ }
+ } else {
+ backgrounds.add(
+ flipHorizontally ? tabIconSet.getCoverTabDisabledFlipped()
+ : tabIconSet.getCoverTabDisabled());
+ }
+ return backgrounds.toArray(new IDrawable[] {});
+ }
+ }.setOnClick((clickData, widget) -> onTabClicked(clickData, widget, side))
+ .dynamicTooltip(() -> getCoverTabTooltip(side)).setSize(COVER_TAB_WIDTH, COVER_TAB_HEIGHT))
.addChild(
- new ButtonWidget() {
- @Override
- public IDrawable[] getBackground() {
- final List<IDrawable> backgrounds = new ArrayList<>();
- final GUITextureSet tabIconSet = getGUITextureSet();
-
- if (getCoverBehaviorAtSideNew(side).hasCoverGUI()) {
- if (isHovering()) {
- backgrounds.add(
- flipHorizontally
- ? tabIconSet.getCoverTabHighlightFlipped()
- : tabIconSet.getCoverTabHighlight());
- } else {
- backgrounds.add(
- flipHorizontally
- ? tabIconSet.getCoverTabNormalFlipped()
- : tabIconSet.getCoverTabNormal());
- }
- } else {
- backgrounds.add(
- flipHorizontally
- ? tabIconSet.getCoverTabDisabledFlipped()
- : tabIconSet.getCoverTabDisabled());
- }
- return backgrounds.toArray(new IDrawable[] {});
- }
- }.setOnClick((clickData, widget) -> onTabClicked(clickData, widget, side))
- .dynamicTooltip(() -> getCoverTabTooltip(side))
- .setSize(COVER_TAB_WIDTH, COVER_TAB_HEIGHT))
- .addChild(new ItemDrawable(() -> {
- return getCoverItemAtSide(side);
- })
- .asWidget()
- .setPos(
+ new ItemDrawable(() -> { return getCoverItemAtSide(side); }).asWidget().setPos(
(COVER_TAB_WIDTH - ICON_SIZE) / 2 + (flipHorizontally ? -1 : 1),
(COVER_TAB_HEIGHT - ICON_SIZE) / 2))
.setEnabled(widget -> getCoverItemAtSide(side) != null));
@@ -685,20 +667,15 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov
@SideOnly(Side.CLIENT)
protected List<String> getCoverTabTooltip(byte side) {
- final String[] SIDE_TOOLTIPS = new String[] {
- "GT5U.interface.coverTabs.down",
- "GT5U.interface.coverTabs.up",
- "GT5U.interface.coverTabs.north",
- "GT5U.interface.coverTabs.south",
- "GT5U.interface.coverTabs.west",
- "GT5U.interface.coverTabs.east"
- };
+ final String[] SIDE_TOOLTIPS = new String[] { "GT5U.interface.coverTabs.down", "GT5U.interface.coverTabs.up",
+ "GT5U.interface.coverTabs.north", "GT5U.interface.coverTabs.south", "GT5U.interface.coverTabs.west",
+ "GT5U.interface.coverTabs.east" };
final CoverInfo coverInfo = getCoverInfoAtSide(side);
final ItemStack coverItem = coverInfo.getDisplayStack();
if (coverItem == null) return Collections.emptyList();
final boolean coverHasGUI = coverInfo.hasCoverGUI();
- //noinspection unchecked
+ // noinspection unchecked
final List<String> tooltip = coverItem.getTooltip(Minecraft.getMinecraft().thePlayer, true);
for (int i = 0; i < tooltip.size(); i++) {
if (i == 0) {
@@ -726,8 +703,7 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov
getWorld().provider.dimensionId,
widget.getContext().getPlayer().getEntityId(),
0);
- GT_Values.NW.sendToPlayer(
- packet, (EntityPlayerMP) widget.getContext().getPlayer());
+ GT_Values.NW.sendToPlayer(packet, (EntityPlayerMP) widget.getContext().getPlayer());
}
}
}
diff --git a/src/main/java/gregtech/api/metatileentity/GregTechTileClientEvents.java b/src/main/java/gregtech/api/metatileentity/GregTechTileClientEvents.java
index d8e8017060..2f560c5f15 100644
--- a/src/main/java/gregtech/api/metatileentity/GregTechTileClientEvents.java
+++ b/src/main/java/gregtech/api/metatileentity/GregTechTileClientEvents.java
@@ -1,6 +1,7 @@
package gregtech.api.metatileentity;
public final class GregTechTileClientEvents {
+
public static final byte CHANGE_COMMON_DATA = 0;
public static final byte CHANGE_CUSTOM_DATA = 1;
public static final byte CHANGE_COLOR = 2;
diff --git a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java
index b433e48b6e..3aa0cbfb32 100644
--- a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java
@@ -3,25 +3,11 @@ package gregtech.api.metatileentity;
import static gregtech.api.enums.GT_Values.GT;
import static gregtech.api.enums.GT_Values.V;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-import gnu.trove.list.TIntList;
-import gnu.trove.list.array.TIntArrayList;
-import gregtech.api.GregTech_API;
-import gregtech.api.enums.Dyes;
-import gregtech.api.interfaces.metatileentity.IConnectable;
-import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
-import gregtech.api.interfaces.tileentity.IColoredTileEntity;
-import gregtech.api.interfaces.tileentity.ICoverable;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.objects.GT_ItemStack;
-import gregtech.api.util.*;
-import gregtech.common.GT_Client;
-import gregtech.common.covers.CoverInfo;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
+
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -41,17 +27,33 @@ import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gnu.trove.list.TIntList;
+import gnu.trove.list.array.TIntArrayList;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Dyes;
+import gregtech.api.interfaces.metatileentity.IConnectable;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IColoredTileEntity;
+import gregtech.api.interfaces.tileentity.ICoverable;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_ItemStack;
+import gregtech.api.util.*;
+import gregtech.common.GT_Client;
+import gregtech.common.covers.CoverInfo;
+
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
* <p/>
- * Extend this Class to add a new MetaPipe
- * Call the Constructor with the desired ID at the load-phase (not preload and also not postload!)
- * Implement the newMetaEntity-Method to return a new ready instance of your MetaTileEntity
+ * Extend this Class to add a new MetaPipe Call the Constructor with the desired ID at the load-phase (not preload and
+ * also not postload!) Implement the newMetaEntity-Method to return a new ready instance of your MetaTileEntity
* <p/>
- * Call the Constructor like the following example inside the Load Phase, to register it.
- * "new GT_MetaTileEntity_E_Furnace(54, "GT_E_Furnace", "Automatic E-Furnace");"
+ * Call the Constructor like the following example inside the Load Phase, to register it. "new
+ * GT_MetaTileEntity_E_Furnace(54, "GT_E_Furnace", "Automatic E-Furnace");"
*/
public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
+
/**
* The Inventory of the MetaTileEntity. Amount of Slots can be larger than 256. HAYO!
*/
@@ -63,7 +65,8 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
protected boolean mCheckConnections = false;
/**
- * Only assigned for the MetaTileEntity in the List! Also only used to get the localized Name for the ItemStack and for getInvName.
+ * Only assigned for the MetaTileEntity in the List! Also only used to get the localized Name for the ItemStack and
+ * for getInvName.
*/
public String mName;
@@ -74,16 +77,14 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
private IGregTechTileEntity mBaseMetaTileEntity;
/**
- * This registers your Machine at the List.
- * Use only ID's larger than 2048, because i reserved these ones.
- * See also the List in the API, as it has a Description containing all the reservations.
+ * This registers your Machine at the List. Use only ID's larger than 2048, because i reserved these ones. See also
+ * the List in the API, as it has a Description containing all the reservations.
*
* @param aID the ID
* @example for Constructor overload.
- * <p/>
- * public GT_MetaTileEntity_EBench(int aID, String mName, String mNameRegional) {
- * super(aID, mName, mNameRegional);
- * }
+ * <p/>
+ * public GT_MetaTileEntity_EBench(int aID, String mName, String mNameRegional) { super(aID, mName,
+ * mNameRegional); }
*/
public MetaPipeEntity(int aID, String aBasicName, String aRegionalName, int aInvSlotCount) {
this(aID, aBasicName, aRegionalName, aInvSlotCount, true);
@@ -156,10 +157,7 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
@Override
public ItemStack getStackForm(long aAmount) {
- return new ItemStack(
- GregTech_API.sBlockMachines,
- (int) aAmount,
- getBaseMetaTileEntity().getMetaTileID());
+ return new ItemStack(GregTech_API.sBlockMachines, (int) aAmount, getBaseMetaTileEntity().getMetaTileID());
}
public boolean isCoverOnSide(BaseMetaPipeEntity aPipe, EntityLivingBase aEntity) {
@@ -199,33 +197,33 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
@Override
public void onServerStart() {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public void onWorldSave(File aSaveDirectory) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public void onWorldLoad(File aSaveDirectory) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public void onConfigLoad(GT_Config aConfig) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public void setItemNBT(NBTTagCompound aNBT) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister aBlockIconRegister) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
@@ -235,48 +233,49 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
@Override
public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
- public boolean onWrenchRightClick(
- byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY,
+ float aZ) {
return false;
}
@Override
- public boolean onWireCutterRightClick(
- byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY,
+ float aZ) {
return false;
}
@Override
- public boolean onSolderingToolRightClick(
- byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY,
+ float aZ) {
return false;
}
@Override
public void onExplosion() {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
if (aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected == 4) {
- /* Client tick counter that is set to 5 on hiding pipes and covers.
- * It triggers a texture update next client tick when reaching 4, with provision for 3 more update tasks,
- * spreading client change detection related work and network traffic on different ticks, until it reaches 0.
+ /*
+ * Client tick counter that is set to 5 on hiding pipes and covers. It triggers a texture update next client
+ * tick when reaching 4, with provision for 3 more update tasks, spreading client change detection related
+ * work and network traffic on different ticks, until it reaches 0.
*/
aBaseMetaTileEntity.issueTextureUpdate();
}
@@ -284,51 +283,50 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
@Override
public void inValidate() {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public void onRemoval() {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public void initDefaultModes(NBTTagCompound aNBT) {
- /*Do nothing*/
+ /* Do nothing */
}
/**
* When a GUI is opened
*/
public void onOpenGUI() {
- /*Do nothing*/
+ /* Do nothing */
}
/**
* When a GUI is closed
*/
public void onCloseGUI() {
- /*Do nothing*/
+ /* Do nothing */
}
/**
- * a Player rightclicks the Machine
- * Sneaky rightclicks are not getting passed to this!
+ * a Player rightclicks the Machine Sneaky rightclicks are not getting passed to this!
*/
@Override
- public boolean onRightclick(
- IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) {
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX,
+ float aY, float aZ) {
return false;
}
@Override
public void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public void onValueUpdate(byte aValue) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
@@ -338,17 +336,17 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
@Override
public void doSound(byte aIndex, double aX, double aY, double aZ) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public void stopSoundLoop(byte aValue, double aX, double aY, double aZ) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
@@ -395,8 +393,8 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
}
@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) {
return aList;
}
@@ -472,12 +470,12 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
@Override
public void onMachineBlockUpdate() {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public void receiveClientEvent(byte aEventID, byte aValue) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
@@ -524,7 +522,7 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
}
public void setItemCount(int aCount) {
- /*Do nothing*/
+ /* Do nothing */
}
public int getMaxItemCount() {
@@ -596,8 +594,7 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
@Override
public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) {
- return isValidSlot(aIndex)
- && aStack != null
+ return isValidSlot(aIndex) && aStack != null
&& aIndex < mInventory.length
&& (mInventory[aIndex] == null || GT_Utility.areStacksEqual(aStack, mInventory[aIndex]))
&& allowPutStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack);
@@ -605,8 +602,7 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
@Override
public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) {
- return isValidSlot(aIndex)
- && aStack != null
+ return isValidSlot(aIndex) && aStack != null
&& aIndex < mInventory.length
&& allowPullStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack);
}
@@ -624,7 +620,7 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection aSide) {
if (getCapacity() <= 0 && !getBaseMetaTileEntity().hasSteamEngineUpgrade()) return new FluidTankInfo[] {};
- return new FluidTankInfo[] {getInfo()};
+ return new FluidTankInfo[] { getInfo() };
}
public int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
@@ -755,72 +751,43 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
@Override
public void doExplosion(long aExplosionPower) {
- float tStrength = aExplosionPower < V[0]
- ? 1.0F
- : aExplosionPower < V[1]
- ? 2.0F
- : aExplosionPower < V[2]
- ? 3.0F
- : aExplosionPower < V[3]
- ? 4.0F
- : aExplosionPower < V[4]
- ? 5.0F
- : aExplosionPower < V[4] * 2
- ? 6.0F
- : aExplosionPower < V[5]
- ? 7.0F
- : aExplosionPower < V[6]
- ? 8.0F
- : aExplosionPower < V[7]
- ? 9.0F
- : aExplosionPower < V[8]
- ? 10.0F
+ float tStrength = aExplosionPower < V[0] ? 1.0F
+ : aExplosionPower < V[1] ? 2.0F
+ : aExplosionPower < V[2] ? 3.0F
+ : aExplosionPower < V[3] ? 4.0F
+ : aExplosionPower < V[4] ? 5.0F
+ : aExplosionPower < V[4] * 2 ? 6.0F
+ : aExplosionPower < V[5] ? 7.0F
+ : aExplosionPower < V[6] ? 8.0F
+ : aExplosionPower < V[7] ? 9.0F
+ : aExplosionPower < V[8] ? 10.0F
: aExplosionPower < V[8] * 2
? 11.0F
: aExplosionPower < V[9]
? 12.0F
: aExplosionPower
- < V[
- 10]
- ? 13.0F
- : aExplosionPower
- < V[
- 11]
- ? 14.0F
+ < V[10] ? 13.0F
: aExplosionPower
- < V[
- 12]
- ? 15.0F
- : aExplosionPower
- < V[
- 12]
- * 2
- ? 16.0F
+ < V[11] ? 14.0F
: aExplosionPower
- < V[
- 13]
- ? 17.0F
- : aExplosionPower
- < V[
- 14]
- ? 18.0F
+ < V[12] ? 15.0F
: aExplosionPower
- < V[
- 15]
- ? 19.0F
- : 20.0F;
- int tX = getBaseMetaTileEntity().getXCoord(),
- tY = getBaseMetaTileEntity().getYCoord(),
+ < V[12] * 2
+ ? 16.0F
+ : aExplosionPower
+ < V[13] ? 17.0F
+ : aExplosionPower
+ < V[14] ? 18.0F
+ : aExplosionPower
+ < V[15] ? 19.0F
+ : 20.0F;
+ int tX = getBaseMetaTileEntity().getXCoord(), tY = getBaseMetaTileEntity().getYCoord(),
tZ = getBaseMetaTileEntity().getZCoord();
World tWorld = getBaseMetaTileEntity().getWorld();
tWorld.setBlock(tX, tY, tZ, Blocks.air);
if (GregTech_API.sMachineExplosions) {
- new WorldSpawnedEventBuilder.ExplosionEffectEventBuilder()
- .setStrength(tStrength)
- .setSmoking(true)
- .setPosition(tX + 0.5, tY + 0.5, tZ + 0.5)
- .setWorld(tWorld)
- .run();
+ new WorldSpawnedEventBuilder.ExplosionEffectEventBuilder().setStrength(tStrength).setSmoking(true)
+ .setPosition(tX + 0.5, tY + 0.5, tZ + 0.5).setWorld(tWorld).run();
}
}
@@ -830,14 +797,8 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
}
@Override
- public void addCollisionBoxesToList(
- World aWorld,
- int aX,
- int aY,
- int aZ,
- AxisAlignedBB inputAABB,
- List<AxisAlignedBB> outputAABB,
- Entity collider) {
+ public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB,
+ List<AxisAlignedBB> outputAABB, Entity collider) {
AxisAlignedBB axisalignedbb1 = getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
if (axisalignedbb1 != null && inputAABB.intersectsWith(axisalignedbb1)) outputAABB.add(axisalignedbb1);
}
@@ -879,8 +840,8 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
private boolean connectableColor(TileEntity tTileEntity) {
// Determine if two entities are connectable based on their colorization:
- // Uncolored can connect to anything
- // If both are colored they must be the same color to connect.
+ // Uncolored can connect to anything
+ // If both are colored they must be the same color to connect.
if (tTileEntity instanceof IColoredTileEntity) {
if (getBaseMetaTileEntity().getColorization() >= 0) {
final byte tColor = ((IColoredTileEntity) tTileEntity).getColorization();
@@ -914,24 +875,22 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
final IMetaTileEntity tPipe = tTileEntity instanceof IGregTechTileEntity
? ((IGregTechTileEntity) tTileEntity).getMetaTileEntity()
: null;
- if (getClass().isInstance(tPipe)
- || (tPipe != null && tPipe.getClass().isInstance(this))) {
+ if (getClass().isInstance(tPipe) || (tPipe != null && tPipe.getClass().isInstance(this))) {
connectAtSide(aSide);
if (!((MetaPipeEntity) tPipe).isConnectedAtSide(tSide)) {
// Make sure pipes all get together -- connect back to us if we're connecting to a pipe
((MetaPipeEntity) tPipe).connect(tSide);
}
return 1;
- } else if ((getGT6StyleConnection() && baseMetaTile.getAirAtSide(aSide))
- || canConnect(aSide, tTileEntity)) {
- // Allow open connections to Air, if the GT6 style pipe/cables are enabled, so that it'll connect to the
- // next block placed down next to it
- connectAtSide(aSide);
- return 1;
- }
- if (!baseMetaTile
- .getWorld()
- .getChunkProvider()
+ } else
+ if ((getGT6StyleConnection() && baseMetaTile.getAirAtSide(aSide)) || canConnect(aSide, tTileEntity)) {
+ // Allow open connections to Air, if the GT6 style pipe/cables are enabled, so that it'll connect to
+ // the
+ // next block placed down next to it
+ connectAtSide(aSide);
+ return 1;
+ }
+ if (!baseMetaTile.getWorld().getChunkProvider()
.chunkExists(baseMetaTile.getOffsetX(aSide, 1) >> 4, baseMetaTile.getOffsetZ(aSide, 1) >> 4)) {
// Target chunk unloaded
return -1;
@@ -941,7 +900,7 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
}
protected void checkConnections() {
- // Verify connections around us. If GT6 style cables are not enabled then revert to old behavior and try
+ // Verify connections around us. If GT6 style cables are not enabled then revert to old behavior and try
// connecting to everything around us
for (byte aSide = 0; aSide < 6; aSide++) {
if ((!getGT6StyleConnection() || isConnectedAtSide(aSide)) && connect(aSide) == 0) {
@@ -962,9 +921,9 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
byte tSide = GT_Utility.getOppositeSide(aSide);
IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSide(aSide);
IMetaTileEntity tPipe = tTileEntity == null ? null : tTileEntity.getMetaTileEntity();
- if ((this.getClass().isInstance(tPipe)
- || (tPipe != null && tPipe.getClass().isInstance(this)))
- && ((MetaPipeEntity) tPipe).isConnectedAtSide(tSide)) ((MetaPipeEntity) tPipe).disconnect(tSide);
+ if ((this.getClass().isInstance(tPipe) || (tPipe != null && tPipe.getClass().isInstance(this)))
+ && ((MetaPipeEntity) tPipe).isConnectedAtSide(tSide))
+ ((MetaPipeEntity) tPipe).disconnect(tSide);
}
@Override
@@ -972,8 +931,8 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
return (mConnections & (1 << aSide)) != 0;
}
- public boolean letsIn(
- GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ public boolean letsIn(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable,
+ ICoverable aTileEntity) {
return false;
}
@@ -981,8 +940,8 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
return false;
}
- public boolean letsOut(
- GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ public boolean letsOut(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable,
+ ICoverable aTileEntity) {
return false;
}
@@ -990,21 +949,13 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
return false;
}
- public boolean letsIn(
- GT_CoverBehaviorBase<?> coverBehavior,
- byte aSide,
- int aCoverID,
- ISerializableObject aCoverVariable,
- ICoverable aTileEntity) {
+ public boolean letsIn(GT_CoverBehaviorBase<?> coverBehavior, byte aSide, int aCoverID,
+ ISerializableObject aCoverVariable, ICoverable aTileEntity) {
return false;
}
- public boolean letsOut(
- GT_CoverBehaviorBase<?> coverBehavior,
- byte aSide,
- int aCoverID,
- ISerializableObject aCoverVariable,
- ICoverable aTileEntity) {
+ public boolean letsOut(GT_CoverBehaviorBase<?> coverBehavior, byte aSide, int aCoverID,
+ ISerializableObject aCoverVariable, ICoverable aTileEntity) {
return false;
}
diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java
index eb4e797c49..64bc531947 100644
--- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java
@@ -2,13 +2,43 @@ package gregtech.api.metatileentity;
import static gregtech.api.enums.GT_Values.V;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import java.util.function.Supplier;
+
+import mcp.mobius.waila.api.IWailaConfigHandler;
+import mcp.mobius.waila.api.IWailaDataAccessor;
+
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+
import appeng.api.implementations.IPowerChannelState;
import appeng.api.networking.energy.IEnergyGrid;
import appeng.api.networking.pathing.IPathingGrid;
import appeng.api.util.AECableType;
import appeng.core.localization.WailaText;
import appeng.me.helpers.AENetworkProxy;
+
import com.gtnewhorizons.modularui.api.forge.ItemStackHandler;
+
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;
@@ -36,46 +66,22 @@ import gregtech.api.util.GT_Util;
import gregtech.api.util.GT_Utility;
import gregtech.common.GT_Client;
import gregtech.common.covers.CoverInfo;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-import java.util.function.Supplier;
-import mcp.mobius.waila.api.IWailaConfigHandler;
-import mcp.mobius.waila.api.IWailaDataAccessor;
-import net.minecraft.block.Block;
-import net.minecraft.client.renderer.RenderBlocks;
-import net.minecraft.client.renderer.texture.IIconRegister;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraft.init.Blocks;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.world.IBlockAccess;
-import net.minecraft.world.World;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.Fluid;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.fluids.FluidTankInfo;
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
* <p/>
- * Extend this Class to add a new MetaMachine
- * Call the Constructor with the desired ID at the load-phase (not preload and also not postload!)
- * Implement the newMetaEntity-Method to return a new ready instance of your MetaTileEntity
+ * Extend this Class to add a new MetaMachine Call the Constructor with the desired ID at the load-phase (not preload
+ * and also not postload!) Implement the newMetaEntity-Method to return a new ready instance of your MetaTileEntity
* <p/>
- * Call the Constructor like the following example inside the Load Phase, to register it.
- * "new GT_MetaTileEntity_E_Furnace(54, "GT_E_Furnace", "Automatic E-Furnace");"
+ * Call the Constructor like the following example inside the Load Phase, to register it. "new
+ * GT_MetaTileEntity_E_Furnace(54, "GT_E_Furnace", "Automatic E-Furnace");"
*/
@SuppressWarnings("unused")
public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallback<MetaTileEntity> {
+
/**
- * Only assigned for the MetaTileEntity in the List! Also only used to get the localized Name for the ItemStack and for getInvName.
+ * Only assigned for the MetaTileEntity in the List! Also only used to get the localized Name for the ItemStack and
+ * for getInvName.
*/
public final String mName;
/**
@@ -108,16 +114,14 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
public long mSoundRequests = 0;
/**
- * This registers your Machine at the List.
- * Use only ID's larger than 2048, because i reserved these ones.
- * See also the List in the API, as it has a Description containing all the reservations.
+ * This registers your Machine at the List. Use only ID's larger than 2048, because i reserved these ones. See also
+ * the List in the API, as it has a Description containing all the reservations.
*
* @param aID the ID
* @example for Constructor overload.
- * <p/>
- * public GT_MetaTileEntity_EBench(int aID, String mName, String mNameRegional) {
- * super(aID, mName, mNameRegional);
- * }
+ * <p/>
+ * public GT_MetaTileEntity_EBench(int aID, String mName, String mNameRegional) { super(aID, mName,
+ * mNameRegional); }
*/
public MetaTileEntity(int aID, String aBasicName, String aRegionalName, int aInvSlotCount) {
if (GregTech_API.sPostloadStarted || !GregTech_API.sPreloadStarted)
@@ -147,6 +151,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
/**
* This method will only be called on client side
+ *
* @return whether the secondary description should be display. default is false
*/
@Deprecated
@@ -173,10 +178,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
@Override
public ItemStack getStackForm(long aAmount) {
- return new ItemStack(
- GregTech_API.sBlockMachines,
- (int) aAmount,
- getBaseMetaTileEntity().getMetaTileID());
+ return new ItemStack(GregTech_API.sBlockMachines, (int) aAmount, getBaseMetaTileEntity().getMetaTileID());
}
@Override
@@ -186,33 +188,33 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
@Override
public void onServerStart() {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public void onWorldSave(File aSaveDirectory) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public void onWorldLoad(File aSaveDirectory) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public void onConfigLoad(GT_Config aConfig) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public void setItemNBT(NBTTagCompound aNBT) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister aBlockIconRegister) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
@@ -222,12 +224,12 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
@Override
public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
- public boolean onWrenchRightClick(
- byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY,
+ float aZ) {
if (getBaseMetaTileEntity().isValidFacing(aWrenchingSide)) {
getBaseMetaTileEntity().setFrontFacing(aWrenchingSide);
return true;
@@ -236,32 +238,30 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
}
@Override
- public boolean onWireCutterRightClick(
- byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY,
+ float aZ) {
if (!aPlayer.isSneaking()) return false;
byte tSide = GT_Utility.getOppositeSide(aWrenchingSide);
TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(aWrenchingSide);
if ((tTileEntity instanceof IGregTechTileEntity)
&& (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable)) {
// The tile entity we're facing is a cable, let's try to connect to it
- return ((IGregTechTileEntity) tTileEntity)
- .getMetaTileEntity()
+ return ((IGregTechTileEntity) tTileEntity).getMetaTileEntity()
.onWireCutterRightClick(aWrenchingSide, tSide, aPlayer, aX, aY, aZ);
}
return false;
}
@Override
- public boolean onSolderingToolRightClick(
- byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY,
+ float aZ) {
if (!aPlayer.isSneaking()) return false;
byte tSide = GT_Utility.getOppositeSide(aWrenchingSide);
TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(aWrenchingSide);
if ((tTileEntity instanceof IGregTechTileEntity)
&& (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable)) {
// The tile entity we're facing is a cable, let's try to connect to it
- return ((IGregTechTileEntity) tTileEntity)
- .getMetaTileEntity()
+ return ((IGregTechTileEntity) tTileEntity).getMetaTileEntity()
.onSolderingToolRightClick(aWrenchingSide, tSide, aPlayer, aX, aY, aZ);
}
return false;
@@ -269,28 +269,34 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
@Override
public void onExplosion() {
- GT_Log.exp.println("Machine at " + this.getBaseMetaTileEntity().getXCoord() + " | "
- + this.getBaseMetaTileEntity().getYCoord() + " | "
- + this.getBaseMetaTileEntity().getZCoord() + " DIMID: "
- + this.getBaseMetaTileEntity().getWorld().provider.dimensionId + " exploded.");
+ GT_Log.exp.println(
+ "Machine at " + this.getBaseMetaTileEntity().getXCoord()
+ + " | "
+ + this.getBaseMetaTileEntity().getYCoord()
+ + " | "
+ + this.getBaseMetaTileEntity().getZCoord()
+ + " DIMID: "
+ + this.getBaseMetaTileEntity().getWorld().provider.dimensionId
+ + " exploded.");
}
@Override
public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
if (aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected == 4) {
- /* Client tick counter that is set to 5 on hiding pipes and covers.
- * It triggers a texture update next client tick when reaching 4, with provision for 3 more update tasks,
- * spreading client change detection related work and network traffic on different ticks, until it reaches 0.
+ /*
+ * Client tick counter that is set to 5 on hiding pipes and covers. It triggers a texture update next client
+ * tick when reaching 4, with provision for 3 more update tasks, spreading client change detection related
+ * work and network traffic on different ticks, until it reaches 0.
*/
aBaseMetaTileEntity.issueTextureUpdate();
}
@@ -298,55 +304,54 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
@Override
public void inValidate() {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public void onRemoval() {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public void initDefaultModes(NBTTagCompound aNBT) {
- /*Do nothing*/
+ /* Do nothing */
}
/**
* When a GUI is opened
*/
public void onOpenGUI() {
- /*Do nothing*/
+ /* Do nothing */
}
/**
* When a GUI is closed
*/
public void onCloseGUI() {
- /*Do nothing*/
+ /* Do nothing */
}
/**
- * a Player rightclicks the Machine
- * Sneaky rightclicks are not getting passed to this!
+ * a Player rightclicks the Machine Sneaky rightclicks are not getting passed to this!
*/
public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
return false;
}
@Override
- public boolean onRightclick(
- IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) {
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX,
+ float aY, float aZ) {
return onRightclick(aBaseMetaTileEntity, aPlayer);
}
@Override
public void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public void onValueUpdate(byte aValue) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
@@ -356,17 +361,17 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
@Override
public void doSound(byte aIndex, double aX, double aY, double aZ) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public void stopSoundLoop(byte aValue, double aX, double aY, double aZ) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
@@ -425,8 +430,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
}
/**
- * @return what type of texture does this machine use for GUI,
- * i.e. Bronze, Steel, or Primitive
+ * @return what type of texture does this machine use for GUI, i.e. Bronze, Steel, or Primitive
*/
public SteamVariant getSteamVariant() {
return SteamVariant.NONE;
@@ -468,8 +472,8 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
}
/**
- * @return the amount of E-net Impulses of the maxEUOutput size, which can be outputted by this Device.
- * Default is 1 Pulse, this shouldn't be set to smaller Values than 1, as it won't output anything in that Case!
+ * @return the amount of E-net Impulses of the maxEUOutput size, which can be outputted by this Device. Default is 1
+ * Pulse, this shouldn't be set to smaller Values than 1, as it won't output anything in that Case!
*/
public long maxAmperesOut() {
return 1;
@@ -570,8 +574,8 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
}
/**
- * @return the amount of EU, which this Device stores before starting to emit Energy.
- * useful if you don't want to emit stored Energy until a certain Level is reached.
+ * @return the amount of EU, which this Device stores before starting to emit Energy. useful if you don't want to
+ * emit stored Energy until a certain Level is reached.
*/
public long getMinimumStoredEU() {
return 512;
@@ -627,8 +631,8 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
}
@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) {
return aList;
}
@@ -683,12 +687,12 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
@Override
public void onMachineBlockUpdate() {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public void receiveClientEvent(byte aEventID, byte aValue) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
@@ -732,8 +736,8 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
}
/**
- * If this TileEntity makes use of Sided Redstone behaviors.
- * Determines only, if the Output Redstone Array is getting filled with 0 for true, or 15 for false.
+ * If this TileEntity makes use of Sided Redstone behaviors. Determines only, if the Output Redstone Array is
+ * getting filled with 0 for true, or 15 for false.
*/
public boolean hasSidedRedstoneOutputBehavior() {
return false;
@@ -743,15 +747,14 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
* When the Facing gets changed.
*/
public void onFacingChange() {
- /*Do nothing*/
+ /* Do nothing */
}
/**
* if the IC2 Teleporter can drain from this.
*/
public boolean isTeleporterCompatible() {
- return isEnetOutput()
- && getBaseMetaTileEntity().getOutputVoltage() >= 128
+ return isEnetOutput() && getBaseMetaTileEntity().getOutputVoltage() >= 128
&& getBaseMetaTileEntity().getUniversalEnergyCapacity() >= 500000;
}
@@ -806,7 +809,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
}
public void setItemCount(int aCount) {
- /*Do nothing*/
+ /* Do nothing */
}
public int getMaxItemCount() {
@@ -889,8 +892,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
@Override
public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) {
- return isValidSlot(aIndex)
- && aStack != null
+ return isValidSlot(aIndex) && aStack != null
&& aIndex < mInventory.length
&& (mInventory[aIndex] == null || GT_Utility.areStacksEqual(aStack, mInventory[aIndex]))
&& allowPutStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack);
@@ -898,8 +900,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
@Override
public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) {
- return isValidSlot(aIndex)
- && aStack != null
+ return isValidSlot(aIndex) && aStack != null
&& aIndex < mInventory.length
&& allowPullStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack);
}
@@ -917,7 +918,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection aSide) {
if (getCapacity() <= 0 && !getBaseMetaTileEntity().hasSteamEngineUpgrade()) return new FluidTankInfo[] {};
- return new FluidTankInfo[] {getInfo()};
+ return new FluidTankInfo[] { getInfo() };
}
public int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
@@ -932,8 +933,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
Integer.MAX_VALUE,
Math.min(
aFluid.amount / 2,
- getBaseMetaTileEntity().getSteamCapacity()
- - getBaseMetaTileEntity().getStoredSteam()));
+ getBaseMetaTileEntity().getSteamCapacity() - getBaseMetaTileEntity().getStoredSteam()));
if (tSteam > 0) {
markDirty();
if (doFill) getBaseMetaTileEntity().increaseStoredSteam(tSteam, true);
@@ -1112,14 +1112,8 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
}
@Override
- public void addCollisionBoxesToList(
- World aWorld,
- int aX,
- int aY,
- int aZ,
- AxisAlignedBB inputAABB,
- List<AxisAlignedBB> outputAABB,
- Entity collider) {
+ public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB,
+ List<AxisAlignedBB> outputAABB, Entity collider) {
AxisAlignedBB axisalignedbb1 = getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
if (axisalignedbb1 != null && inputAABB.intersectsWith(axisalignedbb1)) outputAABB.add(axisalignedbb1);
}
@@ -1186,12 +1180,12 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
// === Waila compat ===
@Override
- public void getWailaBody(
- ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
- currenttip.add(String.format(
- "Facing: %s",
- ForgeDirection.getOrientation(mBaseMetaTileEntity.getFrontFacing())
- .name()));
+ public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
+ IWailaConfigHandler config) {
+ currenttip.add(
+ String.format(
+ "Facing: %s",
+ ForgeDirection.getOrientation(mBaseMetaTileEntity.getFrontFacing()).name()));
if (Loader.isModLoaded("appliedenergistics2") && this instanceof IPowerChannelState) {
// adapted from PowerStateWailaDataProvider
@@ -1214,8 +1208,8 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
}
@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) {
if (Loader.isModLoaded("appliedenergistics2") && this instanceof IPowerChannelState) {
// adapted from PowerStateWailaDataProvider
final IPowerChannelState state = (IPowerChannelState) this;
diff --git a/src/main/java/gregtech/api/metatileentity/TileIC2EnergySink.java b/src/main/java/gregtech/api/metatileentity/TileIC2EnergySink.java
index 661dad730f..6d6ec378d4 100644
--- a/src/main/java/gregtech/api/metatileentity/TileIC2EnergySink.java
+++ b/src/main/java/gregtech/api/metatileentity/TileIC2EnergySink.java
@@ -1,6 +1,10 @@
package gregtech.api.metatileentity;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.util.ForgeDirection;
+
import com.google.common.collect.Sets;
+
import gregtech.api.interfaces.metatileentity.IConnectable;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.metatileentity.IMetaTileEntityCable;
@@ -8,10 +12,9 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Cable;
import gregtech.api.util.GT_Utility;
import ic2.api.energy.tile.IEnergySink;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraftforge.common.util.ForgeDirection;
public class TileIC2EnergySink extends TileEntity implements IEnergySink {
+
private IGregTechTileEntity myMeta;
private GT_MetaPipeEntity_Cable cableMeta = null;
@@ -28,9 +31,7 @@ public class TileIC2EnergySink extends TileEntity implements IEnergySink {
zCoord = meta.getZCoord();
}
/*
- *
* IC2 enet compat - IEnergySink
- *
*/
/**
@@ -48,17 +49,17 @@ public class TileIC2EnergySink extends TileEntity implements IEnergySink {
// We don't want everything to join the enet (treating the cable as a conductor) so we join it as a ink. We
// don't want to traverse all cables
// connected to this (like we would during distribution) to see if it actually needs any EU... so we just
- // always say we want it all. If there
+ // always say we want it all. If there
// are more than two things attached, and one of them is a GT cable that doesn't have anywhere to send it's
// energy, the distribution will be a bit
- // weird. In that case only use one cable, or use a transformer.
+ // weird. In that case only use one cable, or use a transformer.
return (cableMeta.mVoltage * cableMeta.mAmperage);
} else return myMeta.getEUCapacity() - myMeta.getStoredEU();
}
/**
- * Determine the tier of this energy sink.
- * 1 = LV, 2 = MV, 3 = HV, 4 = EV etc.
+ * Determine the tier of this energy sink. 1 = LV, 2 = MV, 3 = HV, 4 = EV etc.
+ *
* @note Return Integer.MAX_VALUE to allow any voltage.
*
* @return tier of this energy sink
@@ -71,18 +72,18 @@ public class TileIC2EnergySink extends TileEntity implements IEnergySink {
/**
* Transfer energy to the sink.
*
- * It's highly recommended to accept all energy by letting the internal buffer overflow to
- * increase the performance and accuracy of the distribution simulation.
+ * It's highly recommended to accept all energy by letting the internal buffer overflow to increase the performance
+ * and accuracy of the distribution simulation.
*
* @param directionFrom direction from which the energy comes from
- * @param amount energy to be transferred
+ * @param amount energy to be transferred
* @return Energy not consumed (leftover)
*/
@Override
public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage) {
- final long amps = (long)
- Math.max(amount / (cableMeta != null ? cableMeta.mVoltage : myMeta.getInputVoltage() * 1.0), 1.0);
+ final long amps = (long) Math
+ .max(amount / (cableMeta != null ? cableMeta.mVoltage : myMeta.getInputVoltage() * 1.0), 1.0);
final long euPerAmp = (long) (amount / (amps * 1.0));
final IMetaTileEntity metaTile = myMeta.getMetaTileEntity();
@@ -90,16 +91,14 @@ public class TileIC2EnergySink extends TileEntity implements IEnergySink {
final long usedAmps;
if (cableMeta != null) {
- usedAmps = ((IMetaTileEntityCable) metaTile)
- .transferElectricity(
- (byte) directionFrom.ordinal(),
- Math.min(euPerAmp, cableMeta.mVoltage),
- amps,
- Sets.newHashSet((TileEntity) myMeta));
+ usedAmps = ((IMetaTileEntityCable) metaTile).transferElectricity(
+ (byte) directionFrom.ordinal(),
+ Math.min(euPerAmp, cableMeta.mVoltage),
+ amps,
+ Sets.newHashSet((TileEntity) myMeta));
- } else
- usedAmps = myMeta.injectEnergyUnits(
- (byte) directionFrom.ordinal(), Math.min(euPerAmp, myMeta.getInputVoltage()), amps);
+ } else usedAmps = myMeta
+ .injectEnergyUnits((byte) directionFrom.ordinal(), Math.min(euPerAmp, myMeta.getInputVoltage()), amps);
return amount - (usedAmps * euPerAmp);
// transferElectricity for cables
@@ -108,18 +107,18 @@ public class TileIC2EnergySink extends TileEntity implements IEnergySink {
/**
* Determine if this acceptor can accept current from an adjacent emitter in a direction.
*
- * The TileEntity in the emitter parameter is what was originally added to the energy net,
- * which may be normal in-world TileEntity, a delegate or an IMetaDelegate.
+ * The TileEntity in the emitter parameter is what was originally added to the energy net, which may be normal
+ * in-world TileEntity, a delegate or an IMetaDelegate.
*
- * @param emitter energy emitter, may also be null or an IMetaDelegate
+ * @param emitter energy emitter, may also be null or an IMetaDelegate
* @param direction direction the energy is being received from
*/
@Override
public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction) {
final IMetaTileEntity metaTile = myMeta.getMetaTileEntity();
- if (metaTile instanceof IMetaTileEntityCable
- && (direction == ForgeDirection.UNKNOWN
- || ((IConnectable) metaTile).isConnectedAtSide(direction.ordinal()))) return true;
+ if (metaTile instanceof IMetaTileEntityCable && (direction == ForgeDirection.UNKNOWN
+ || ((IConnectable) metaTile).isConnectedAtSide(direction.ordinal())))
+ return true;
else return myMeta.inputEnergyFrom((byte) direction.ordinal(), false);
}
}
diff --git a/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java b/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java
index be1904aaf5..a372a37103 100644
--- a/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java
+++ b/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java
@@ -2,6 +2,8 @@ package gregtech.api.metatileentity.examples;
import static gregtech.api.enums.Textures.BlockIcons.*;
+import net.minecraft.item.ItemStack;
+
import gregtech.api.enums.SoundResource;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -10,12 +12,12 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachin
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Utility;
-import net.minecraft.item.ItemStack;
/**
* This Example Implementation still works, however I use something completely different in my own Code.
*/
public class GT_MetaTileEntity_E_Furnace extends GT_MetaTileEntity_BasicMachine {
+
public GT_MetaTileEntity_E_Furnace(int aID, String aName, String aNameRegional, int aTier) {
super(
aID,
@@ -30,66 +32,37 @@ public class GT_MetaTileEntity_E_Furnace extends GT_MetaTileEntity_BasicMachine
"smelting",
TextureFactory.of(
TextureFactory.of(OVERLAY_SIDE_STEAM_FURNACE_ACTIVE),
- TextureFactory.builder()
- .addIcon(OVERLAY_SIDE_STEAM_FURNACE_ACTIVE_GLOW)
- .glow()
- .build()),
+ TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_FURNACE_ACTIVE_GLOW).glow().build()),
TextureFactory.of(
TextureFactory.of(OVERLAY_SIDE_STEAM_FURNACE),
- TextureFactory.builder()
- .addIcon(OVERLAY_SIDE_STEAM_FURNACE_GLOW)
- .glow()
- .build()),
+ TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_FURNACE_GLOW).glow().build()),
TextureFactory.of(
TextureFactory.of(OVERLAY_FRONT_STEAM_FURNACE_ACTIVE),
- TextureFactory.builder()
- .addIcon(OVERLAY_FRONT_STEAM_FURNACE_ACTIVE_GLOW)
- .glow()
- .build()),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_FURNACE_ACTIVE_GLOW).glow().build()),
TextureFactory.of(
TextureFactory.of(OVERLAY_FRONT_STEAM_FURNACE),
- TextureFactory.builder()
- .addIcon(OVERLAY_FRONT_STEAM_FURNACE_GLOW)
- .glow()
- .build()),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_FURNACE_GLOW).glow().build()),
TextureFactory.of(
TextureFactory.of(OVERLAY_TOP_STEAM_FURNACE_ACTIVE),
- TextureFactory.builder()
- .addIcon(OVERLAY_TOP_STEAM_FURNACE_ACTIVE_GLOW)
- .glow()
- .build()),
+ TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_FURNACE_ACTIVE_GLOW).glow().build()),
TextureFactory.of(
TextureFactory.of(OVERLAY_TOP_STEAM_FURNACE),
- TextureFactory.builder()
- .addIcon(OVERLAY_TOP_STEAM_FURNACE_GLOW)
- .glow()
- .build()),
+ TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_FURNACE_GLOW).glow().build()),
TextureFactory.of(
TextureFactory.of(OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE),
- TextureFactory.builder()
- .addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE_GLOW)
- .glow()
- .build()),
+ TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE_GLOW).glow().build()),
TextureFactory.of(
TextureFactory.of(OVERLAY_BOTTOM_STEAM_FURNACE),
- TextureFactory.builder()
- .addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_GLOW)
- .glow()
- .build()));
+ TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_GLOW).glow().build()));
}
- public GT_MetaTileEntity_E_Furnace(
- String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
+ public GT_MetaTileEntity_E_Furnace(String aName, int aTier, String aDescription, ITexture[][][] aTextures,
+ String aGUIName, String aNEIName) {
super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
}
- public GT_MetaTileEntity_E_Furnace(
- String aName,
- int aTier,
- String[] aDescription,
- ITexture[][][] aTextures,
- String aGUIName,
- String aNEIName) {
+ public GT_MetaTileEntity_E_Furnace(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures,
+ String aGUIName, String aNEIName) {
super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
}
@@ -110,8 +83,8 @@ public class GT_MetaTileEntity_E_Furnace extends GT_MetaTileEntity_BasicMachine
}
@Override
- protected boolean allowPutStackValidated(
- IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide,
+ ItemStack aStack) {
return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack)
&& GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(64, aStack), false, null) != null;
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java
index 750b50d652..1ea2e3e756 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java
@@ -2,6 +2,22 @@ package gregtech.api.metatileentity.implementations;
import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+
import cofh.api.energy.IEnergyReceiver;
import cpw.mods.fml.common.Loader;
import gregtech.GT_Mod;
@@ -36,33 +52,16 @@ import ic2.api.energy.tile.IEnergySink;
import ic2.api.energy.tile.IEnergySource;
import ic2.api.energy.tile.IEnergyTile;
import ic2.api.reactor.IReactorChamber;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.util.StatCollector;
-import net.minecraft.world.World;
-import net.minecraftforge.common.util.ForgeDirection;
public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTileEntityCable {
+
public final float mThickNess;
public final Materials mMaterial;
public final long mCableLossPerMeter, mAmperage, mVoltage;
public final boolean mInsulated, mCanShock;
- public int mTransferredAmperage = 0,
- mTransferredAmperageLast20 = 0,
- mTransferredAmperageLast20OK = 0,
+ public int mTransferredAmperage = 0, mTransferredAmperageLast20 = 0, mTransferredAmperageLast20OK = 0,
mTransferredAmperageOK = 0;
- public long mTransferredVoltageLast20 = 0,
- mTransferredVoltage = 0,
- mTransferredVoltageLast20OK = 0,
+ public long mTransferredVoltageLast20 = 0, mTransferredVoltage = 0, mTransferredVoltageLast20OK = 0,
mTransferredVoltageOK = 0;
public long mRestRF;
public int mOverheat;
@@ -71,17 +70,8 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
private int[] lastAmperage;
private long lastWorldTick;
- public GT_MetaPipeEntity_Cable(
- int aID,
- String aName,
- String aNameRegional,
- float aThickNess,
- Materials aMaterial,
- long aCableLossPerMeter,
- long aAmperage,
- long aVoltage,
- boolean aInsulated,
- boolean aCanShock) {
+ public GT_MetaPipeEntity_Cable(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial,
+ long aCableLossPerMeter, long aAmperage, long aVoltage, boolean aInsulated, boolean aCanShock) {
super(aID, aName, aNameRegional, 0);
mThickNess = aThickNess;
mMaterial = aMaterial;
@@ -92,15 +82,8 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
mCableLossPerMeter = aCableLossPerMeter;
}
- public GT_MetaPipeEntity_Cable(
- String aName,
- float aThickNess,
- Materials aMaterial,
- long aCableLossPerMeter,
- long aAmperage,
- long aVoltage,
- boolean aInsulated,
- boolean aCanShock) {
+ public GT_MetaPipeEntity_Cable(String aName, float aThickNess, Materials aMaterial, long aCableLossPerMeter,
+ long aAmperage, long aVoltage, boolean aInsulated, boolean aCanShock) {
super(aName, 0);
mThickNess = aThickNess;
mMaterial = aMaterial;
@@ -119,87 +102,77 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
@Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MetaPipeEntity_Cable(
- mName, mThickNess, mMaterial, mCableLossPerMeter, mAmperage, mVoltage, mInsulated, mCanShock);
- }
-
- @Override
- public ITexture[] getTexture(
- IGregTechTileEntity aBaseMetaTileEntity,
- byte aSide,
- byte aConnections,
- byte aColorIndex,
- boolean aConnected,
- boolean aRedstone) {
- if (!mInsulated)
- return new ITexture[] {
- TextureFactory.of(
- mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire],
- Dyes.getModulation(aColorIndex, mMaterial.mRGBa))
- };
+ mName,
+ mThickNess,
+ mMaterial,
+ mCableLossPerMeter,
+ mAmperage,
+ mVoltage,
+ mInsulated,
+ mCanShock);
+ }
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections,
+ byte aColorIndex, boolean aConnected, boolean aRedstone) {
+ if (!mInsulated) return new ITexture[] { TextureFactory.of(
+ mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire],
+ Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) };
if (aConnected) {
float tThickNess = getThickNess();
- if (tThickNess < 0.124F)
- return new ITexture[] {
- TextureFactory.of(
- Textures.BlockIcons.INSULATION_FULL,
- Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))
- };
+ if (tThickNess < 0.124F) return new ITexture[] { TextureFactory.of(
+ Textures.BlockIcons.INSULATION_FULL,
+ Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
if (tThickNess < 0.374F) // 0.375 x1
- return new ITexture[] {
- TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa),
- TextureFactory.of(
- Textures.BlockIcons.INSULATION_TINY,
- Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))
- };
+ return new ITexture[] {
+ TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa),
+ TextureFactory.of(
+ Textures.BlockIcons.INSULATION_TINY,
+ Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
if (tThickNess < 0.499F) // 0.500 x2
- return new ITexture[] {
- TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa),
- TextureFactory.of(
- Textures.BlockIcons.INSULATION_SMALL,
- Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))
- };
+ return new ITexture[] {
+ TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa),
+ TextureFactory.of(
+ Textures.BlockIcons.INSULATION_SMALL,
+ Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
if (tThickNess < 0.624F) // 0.625 x4
- return new ITexture[] {
- TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa),
- TextureFactory.of(
- Textures.BlockIcons.INSULATION_MEDIUM,
- Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))
- };
+ return new ITexture[] {
+ TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa),
+ TextureFactory.of(
+ Textures.BlockIcons.INSULATION_MEDIUM,
+ Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
if (tThickNess < 0.749F) // 0.750 x8
- return new ITexture[] {
- TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa),
- TextureFactory.of(
- Textures.BlockIcons.INSULATION_MEDIUM_PLUS,
- Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))
- };
+ return new ITexture[] {
+ TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa),
+ TextureFactory.of(
+ Textures.BlockIcons.INSULATION_MEDIUM_PLUS,
+ Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
if (tThickNess < 0.874F) // 0.825 x12
+ return new ITexture[] {
+ TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa),
+ TextureFactory.of(
+ Textures.BlockIcons.INSULATION_LARGE,
+ Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
return new ITexture[] {
TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa),
TextureFactory.of(
- Textures.BlockIcons.INSULATION_LARGE,
- Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))
- };
- return new ITexture[] {
- TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa),
- TextureFactory.of(
- Textures.BlockIcons.INSULATION_HUGE,
- Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))
- };
+ Textures.BlockIcons.INSULATION_HUGE,
+ Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
}
- return new ITexture[] {
- TextureFactory.of(
- Textures.BlockIcons.INSULATION_FULL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))
- };
+ return new ITexture[] { TextureFactory.of(
+ Textures.BlockIcons.INSULATION_FULL,
+ Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
}
@Override
public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity aEntity) {
- if (mCanShock
- && (((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections & -128) == 0
+ if (mCanShock && (((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections & -128) == 0
&& aEntity instanceof EntityLivingBase
&& !isCoverOnSide((BaseMetaPipeEntity) getBaseMetaTileEntity(), (EntityLivingBase) aEntity))
GT_Utility.applyElectricityDamage(
- (EntityLivingBase) aEntity, mTransferredVoltageLast20, mTransferredAmperageLast20);
+ (EntityLivingBase) aEntity,
+ mTransferredVoltageLast20,
+ mTransferredAmperageLast20);
}
@Override
@@ -242,8 +215,8 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
@Override
@Deprecated
- public long transferElectricity(
- byte aSide, long aVoltage, long aAmperage, ArrayList<TileEntity> aAlreadyPassedTileEntityList) {
+ public long transferElectricity(byte aSide, long aVoltage, long aAmperage,
+ ArrayList<TileEntity> aAlreadyPassedTileEntityList) {
return transferElectricity(aSide, aVoltage, aAmperage, new HashSet<>(aAlreadyPassedTileEntityList));
}
@@ -275,24 +248,24 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {
if (aBaseMetaTileEntity.isServerSide()) {
lastAmperage = new int[16];
- lastWorldTick = aBaseMetaTileEntity.getWorld().getTotalWorldTime()
- - 1; // sets initial value -1 since it is in the same tick as first on post tick
+ lastWorldTick = aBaseMetaTileEntity.getWorld().getTotalWorldTime() - 1; // sets initial value -1 since it is
+ // in the same tick as first on post
+ // tick
}
}
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
super.onPostTick(aBaseMetaTileEntity, aTick);
- if (aTick % 20 == 0
- && aBaseMetaTileEntity.isServerSide()
+ if (aTick % 20 == 0 && aBaseMetaTileEntity.isServerSide()
&& (!GT_Mod.gregtechproxy.gt6Cable || mCheckConnections)) {
checkConnections();
}
}
@Override
- public boolean onWireCutterRightClick(
- byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY,
+ float aZ) {
if (GT_Mod.gregtechproxy.gt6Cable
&& GT_ModHandler.damageOrDechargeItem(aPlayer.inventory.getCurrentItem(), 1, 500, aPlayer)) {
if (isConnectedAtSide(aWrenchingSide)) {
@@ -308,8 +281,8 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
}
@Override
- public boolean onSolderingToolRightClick(
- byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY,
+ float aZ) {
if (GT_Mod.gregtechproxy.gt6Cable
&& GT_ModHandler.damageOrDechargeItem(aPlayer.inventory.getCurrentItem(), 1, 500, aPlayer)) {
if (isConnectedAtSide(aWrenchingSide)) {
@@ -325,34 +298,26 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
}
@Override
- public boolean letsIn(
- GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ public boolean letsIn(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable,
+ ICoverable aTileEntity) {
return coverBehavior.letsEnergyIn(aSide, aCoverID, aCoverVariable, aTileEntity);
}
@Override
- public boolean letsOut(
- GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ public boolean letsOut(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable,
+ ICoverable aTileEntity) {
return coverBehavior.letsEnergyOut(aSide, aCoverID, aCoverVariable, aTileEntity);
}
@Override
- public boolean letsIn(
- GT_CoverBehaviorBase<?> coverBehavior,
- byte aSide,
- int aCoverID,
- ISerializableObject aCoverVariable,
- ICoverable aTileEntity) {
+ public boolean letsIn(GT_CoverBehaviorBase<?> coverBehavior, byte aSide, int aCoverID,
+ ISerializableObject aCoverVariable, ICoverable aTileEntity) {
return coverBehavior.letsEnergyIn(aSide, aCoverID, aCoverVariable, aTileEntity);
}
@Override
- public boolean letsOut(
- GT_CoverBehaviorBase<?> coverBehavior,
- byte aSide,
- int aCoverID,
- ISerializableObject aCoverVariable,
- ICoverable aTileEntity) {
+ public boolean letsOut(GT_CoverBehaviorBase<?> coverBehavior, byte aSide, int aCoverID,
+ ISerializableObject aCoverVariable, ICoverable aTileEntity) {
return coverBehavior.letsEnergyOut(aSide, aCoverID, aCoverVariable, aTileEntity);
}
@@ -374,9 +339,9 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
final ForgeDirection tDir = ForgeDirection.getOrientation(tSide);
// GT Machine handling
- if ((tTileEntity instanceof IEnergyConnected)
- && (((IEnergyConnected) tTileEntity).inputEnergyFrom(tSide, false)
- || ((IEnergyConnected) tTileEntity).outputsEnergyTo(tSide, false))) return true;
+ if ((tTileEntity instanceof IEnergyConnected) && (((IEnergyConnected) tTileEntity).inputEnergyFrom(tSide, false)
+ || ((IEnergyConnected) tTileEntity).outputsEnergyTo(tSide, false)))
+ return true;
// Solar Panel Compat
if (coverBehavior instanceof GT_Cover_SolarPanel) return true;
@@ -398,15 +363,18 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
if (tTileEntity instanceof IReactorChamber)
ic2Energy = (TileEntity) ((IReactorChamber) tTileEntity).getReactor();
- else
- ic2Energy = (tTileEntity == null || tTileEntity instanceof IEnergyTile || EnergyNet.instance == null)
- ? tTileEntity
- : EnergyNet.instance.getTileEntity(
- tTileEntity.getWorldObj(), tTileEntity.xCoord, tTileEntity.yCoord, tTileEntity.zCoord);
+ else ic2Energy = (tTileEntity == null || tTileEntity instanceof IEnergyTile || EnergyNet.instance == null)
+ ? tTileEntity
+ : EnergyNet.instance.getTileEntity(
+ tTileEntity.getWorldObj(),
+ tTileEntity.xCoord,
+ tTileEntity.yCoord,
+ tTileEntity.zCoord);
// IC2 Sink Compat
if ((ic2Energy instanceof IEnergySink)
- && ((IEnergySink) ic2Energy).acceptsEnergyFrom((TileEntity) baseMetaTile, tDir)) return true;
+ && ((IEnergySink) ic2Energy).acceptsEnergyFrom((TileEntity) baseMetaTile, tDir))
+ return true;
// IC2 Source Compat
if (GT_Mod.gregtechproxy.ic2EnergySourceCompat && (ic2Energy instanceof IEnergySource)) {
@@ -416,14 +384,13 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
}
}
// RF Output Compat
- if (GregTech_API.mOutputRF
- && tTileEntity instanceof IEnergyReceiver
- && ((IEnergyReceiver) tTileEntity).canConnectEnergy(tDir)) return true;
+ if (GregTech_API.mOutputRF && tTileEntity instanceof IEnergyReceiver
+ && ((IEnergyReceiver) tTileEntity).canConnectEnergy(tDir))
+ return true;
// RF Input Compat
- return GregTech_API.mInputRF
- && (tTileEntity instanceof IEnergyEmitter
- && ((IEnergyEmitter) tTileEntity).emitsEnergyTo((TileEntity) baseMetaTile, tDir));
+ return GregTech_API.mInputRF && (tTileEntity instanceof IEnergyEmitter
+ && ((IEnergyEmitter) tTileEntity).emitsEnergyTo((TileEntity) baseMetaTile, tDir));
}
@Override
@@ -445,16 +412,24 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
@Override
public String[] getDescription() {
return new String[] {
- StatCollector.translateToLocal("GT5U.item.cable.max_voltage") + ": %%%" + EnumChatFormatting.GREEN
- + GT_Utility.formatNumbers(mVoltage) + " ("
- + GT_Utility.getColoredTierNameFromVoltage(mVoltage)
- + EnumChatFormatting.GREEN + ")" + EnumChatFormatting.GRAY,
- StatCollector.translateToLocal("GT5U.item.cable.max_amperage") + ": %%%" + EnumChatFormatting.YELLOW
- + GT_Utility.formatNumbers(mAmperage) + EnumChatFormatting.GRAY,
- StatCollector.translateToLocal("GT5U.item.cable.loss") + ": %%%" + EnumChatFormatting.RED
- + GT_Utility.formatNumbers(mCableLossPerMeter) + EnumChatFormatting.GRAY + "%%% "
- + StatCollector.translateToLocal("GT5U.item.cable.eu_volt")
- };
+ StatCollector.translateToLocal("GT5U.item.cable.max_voltage") + ": %%%"
+ + EnumChatFormatting.GREEN
+ + GT_Utility.formatNumbers(mVoltage)
+ + " ("
+ + GT_Utility.getColoredTierNameFromVoltage(mVoltage)
+ + EnumChatFormatting.GREEN
+ + ")"
+ + EnumChatFormatting.GRAY,
+ StatCollector.translateToLocal("GT5U.item.cable.max_amperage") + ": %%%"
+ + EnumChatFormatting.YELLOW
+ + GT_Utility.formatNumbers(mAmperage)
+ + EnumChatFormatting.GRAY,
+ StatCollector.translateToLocal("GT5U.item.cable.loss") + ": %%%"
+ + EnumChatFormatting.RED
+ + GT_Utility.formatNumbers(mCableLossPerMeter)
+ + EnumChatFormatting.GRAY
+ + "%%% "
+ + StatCollector.translateToLocal("GT5U.item.cable.eu_volt") };
}
@Override
@@ -491,21 +466,38 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
volts = path.getVoltage(this);
}
return new String[] {
- // EnumChatFormatting.BLUE + mName + EnumChatFormatting.RESET,
- "Heat: " + EnumChatFormatting.RED
- + GT_Utility.formatNumbers(mOverheat) + EnumChatFormatting.RESET + " / " + EnumChatFormatting.YELLOW
- + GT_Utility.formatNumbers(mMaxOverheat) + EnumChatFormatting.RESET,
- "Max Load (1t):",
- EnumChatFormatting.GREEN + GT_Utility.formatNumbers(amps) + EnumChatFormatting.RESET + " A / "
- + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mAmperage) + EnumChatFormatting.RESET + " A",
- "Max EU/p (1t):",
- EnumChatFormatting.GREEN + GT_Utility.formatNumbers(volts) + EnumChatFormatting.RESET + " EU / "
- + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mVoltage) + EnumChatFormatting.RESET + " EU",
- "Max Load (20t): " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mTransferredAmperageLast20OK)
- + EnumChatFormatting.RESET + " A",
- "Max EU/p (20t): " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mTransferredVoltageLast20OK)
- + EnumChatFormatting.RESET + " EU"
- };
+ // EnumChatFormatting.BLUE + mName + EnumChatFormatting.RESET,
+ "Heat: " + EnumChatFormatting.RED
+ + GT_Utility.formatNumbers(mOverheat)
+ + EnumChatFormatting.RESET
+ + " / "
+ + EnumChatFormatting.YELLOW
+ + GT_Utility.formatNumbers(mMaxOverheat)
+ + EnumChatFormatting.RESET,
+ "Max Load (1t):",
+ EnumChatFormatting.GREEN + GT_Utility.formatNumbers(amps)
+ + EnumChatFormatting.RESET
+ + " A / "
+ + EnumChatFormatting.YELLOW
+ + GT_Utility.formatNumbers(mAmperage)
+ + EnumChatFormatting.RESET
+ + " A",
+ "Max EU/p (1t):",
+ EnumChatFormatting.GREEN + GT_Utility.formatNumbers(volts)
+ + EnumChatFormatting.RESET
+ + " EU / "
+ + EnumChatFormatting.YELLOW
+ + GT_Utility.formatNumbers(mVoltage)
+ + EnumChatFormatting.RESET
+ + " EU",
+ "Max Load (20t): " + EnumChatFormatting.GREEN
+ + GT_Utility.formatNumbers(mTransferredAmperageLast20OK)
+ + EnumChatFormatting.RESET
+ + " A",
+ "Max EU/p (20t): " + EnumChatFormatting.GREEN
+ + GT_Utility.formatNumbers(mTransferredVoltageLast20OK)
+ + EnumChatFormatting.RESET
+ + " EU" };
}
@Override
@@ -557,19 +549,13 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
if ((tConn & (1 << ForgeDirection.WEST.ordinal())) != 0) tSide4 = 0f;
if ((tConn & (1 << ForgeDirection.EAST.ordinal())) != 0) tSide5 = 1f;
- return AxisAlignedBB.getBoundingBox(
- aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3);
+ return AxisAlignedBB
+ .getBoundingBox(aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3);
}
@Override
- public void addCollisionBoxesToList(
- World aWorld,
- int aX,
- int aY,
- int aZ,
- AxisAlignedBB inputAABB,
- List<AxisAlignedBB> outputAABB,
- Entity collider) {
+ public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB,
+ List<AxisAlignedBB> outputAABB, Entity collider) {
super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider);
if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0) {
final AxisAlignedBB aabb = getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
@@ -583,20 +569,19 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
if (mConnections != 0) {
final IGregTechTileEntity baseMeta = getBaseMetaTileEntity();
- for (byte aSide = 0; aSide < 6; aSide++)
- if (isConnectedAtSide(aSide)) {
- final TileEntity tTileEntity = baseMeta.getTileEntityAtSide(aSide);
- final TileEntity tEmitter =
- (tTileEntity == null || tTileEntity instanceof IEnergyTile || EnergyNet.instance == null)
- ? tTileEntity
- : EnergyNet.instance.getTileEntity(
- tTileEntity.getWorldObj(),
- tTileEntity.xCoord,
- tTileEntity.yCoord,
- tTileEntity.zCoord);
-
- if (tEmitter instanceof IEnergyEmitter) return true;
- }
+ for (byte aSide = 0; aSide < 6; aSide++) if (isConnectedAtSide(aSide)) {
+ final TileEntity tTileEntity = baseMeta.getTileEntityAtSide(aSide);
+ final TileEntity tEmitter = (tTileEntity == null || tTileEntity instanceof IEnergyTile
+ || EnergyNet.instance == null)
+ ? tTileEntity
+ : EnergyNet.instance.getTileEntity(
+ tTileEntity.getWorldObj(),
+ tTileEntity.xCoord,
+ tTileEntity.yCoord,
+ tTileEntity.zCoord);
+
+ if (tEmitter instanceof IEnergyEmitter) return true;
+ }
}
return false;
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java
index 61d55bfd9b..29237218a1 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java
@@ -3,6 +3,25 @@ package gregtech.api.metatileentity.implementations;
import static gregtech.api.enums.GT_Values.D1;
import static gregtech.api.objects.XSTR.XSTR_INSTANCE;
+import java.util.ArrayList;
+import java.util.List;
+
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidHandler;
+
+import org.apache.commons.lang3.tuple.MutableTriple;
+
import cpw.mods.fml.common.Optional;
import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
@@ -21,24 +40,9 @@ import gregtech.common.GT_Client;
import gregtech.common.covers.CoverInfo;
import gregtech.common.covers.GT_Cover_Drain;
import gregtech.common.covers.GT_Cover_FluidRegulator;
-import java.util.ArrayList;
-import java.util.List;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.world.World;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.fluids.FluidTankInfo;
-import net.minecraftforge.fluids.IFluidHandler;
-import org.apache.commons.lang3.tuple.MutableTriple;
public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
+
public final float mThickNess;
public final Materials mMaterial;
public final int mCapacity, mHeatResistance, mPipeAmount;
@@ -50,28 +54,13 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
*/
public byte mDisableInput = 0;
- public GT_MetaPipeEntity_Fluid(
- int aID,
- String aName,
- String aNameRegional,
- float aThickNess,
- Materials aMaterial,
- int aCapacity,
- int aHeatResistance,
- boolean aGasProof) {
+ public GT_MetaPipeEntity_Fluid(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial,
+ int aCapacity, int aHeatResistance, boolean aGasProof) {
this(aID, aName, aNameRegional, aThickNess, aMaterial, aCapacity, aHeatResistance, aGasProof, 1);
}
- public GT_MetaPipeEntity_Fluid(
- int aID,
- String aName,
- String aNameRegional,
- float aThickNess,
- Materials aMaterial,
- int aCapacity,
- int aHeatResistance,
- boolean aGasProof,
- int aFluidTypes) {
+ public GT_MetaPipeEntity_Fluid(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial,
+ int aCapacity, int aHeatResistance, boolean aGasProof, int aFluidTypes) {
super(aID, aName, aNameRegional, 0, false);
mThickNess = aThickNess;
mMaterial = aMaterial;
@@ -84,24 +73,13 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
}
@Deprecated
- public GT_MetaPipeEntity_Fluid(
- String aName,
- float aThickNess,
- Materials aMaterial,
- int aCapacity,
- int aHeatResistance,
- boolean aGasProof) {
+ public GT_MetaPipeEntity_Fluid(String aName, float aThickNess, Materials aMaterial, int aCapacity,
+ int aHeatResistance, boolean aGasProof) {
this(aName, aThickNess, aMaterial, aCapacity, aHeatResistance, aGasProof, 1);
}
- public GT_MetaPipeEntity_Fluid(
- String aName,
- float aThickNess,
- Materials aMaterial,
- int aCapacity,
- int aHeatResistance,
- boolean aGasProof,
- int aFluidTypes) {
+ public GT_MetaPipeEntity_Fluid(String aName, float aThickNess, Materials aMaterial, int aCapacity,
+ int aHeatResistance, boolean aGasProof, int aFluidTypes) {
super(aName, 0);
mThickNess = aThickNess;
mMaterial = aMaterial;
@@ -120,79 +98,61 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
@Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MetaPipeEntity_Fluid(
- mName, mThickNess, mMaterial, mCapacity, mHeatResistance, mGasProof, mPipeAmount);
+ mName,
+ mThickNess,
+ mMaterial,
+ mCapacity,
+ mHeatResistance,
+ mGasProof,
+ mPipeAmount);
}
@Override
- public ITexture[] getTexture(
- IGregTechTileEntity aBaseMetaTileEntity,
- byte aSide,
- byte aConnections,
- byte aColorIndex,
- boolean aConnected,
- boolean aRedstone) {
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections,
+ byte aColorIndex, boolean aConnected, boolean aRedstone) {
final float tThickNess = getThickNess();
if (mDisableInput == 0)
- return new ITexture[] {
- aConnected
- ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex)
- : TextureFactory.of(
- mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex],
- Dyes.getModulation(aColorIndex, mMaterial.mRGBa))
- };
+ return new ITexture[] { aConnected ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex)
+ : TextureFactory.of(
+ mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex],
+ Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) };
byte tMask = 0;
- final byte[][] sRestrictionArray = {
- {2, 3, 5, 4},
- {2, 3, 4, 5},
- {1, 0, 4, 5},
- {1, 0, 4, 5},
- {1, 0, 2, 3},
- {1, 0, 2, 3}
- };
+ final byte[][] sRestrictionArray = { { 2, 3, 5, 4 }, { 2, 3, 4, 5 }, { 1, 0, 4, 5 }, { 1, 0, 4, 5 },
+ { 1, 0, 2, 3 }, { 1, 0, 2, 3 } };
if (aSide >= 0 && aSide < 6) {
for (byte i = 0; i < 4; i++) if (isInputDisabledAtSide(sRestrictionArray[aSide][i])) tMask |= 1 << i;
- // Full block size renderer flips side 5 and 2 textures, flip restrictor textures to compensate
+ // Full block size renderer flips side 5 and 2 textures, flip restrictor textures to compensate
if (aSide == 5 || aSide == 2) if (tMask > 3 && tMask < 12) tMask = (byte) (tMask ^ 12);
}
- return new ITexture[] {
- aConnected
- ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex)
- : TextureFactory.of(
- mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex],
- Dyes.getModulation(aColorIndex, mMaterial.mRGBa)),
- getRestrictorTexture(tMask)
- };
+ return new ITexture[] { aConnected ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex)
+ : TextureFactory.of(
+ mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex],
+ Dyes.getModulation(aColorIndex, mMaterial.mRGBa)),
+ getRestrictorTexture(tMask) };
}
protected static ITexture getBaseTexture(float aThickNess, int aPipeAmount, Materials aMaterial, byte aColorIndex) {
- if (aPipeAmount >= 9)
- return TextureFactory.of(
- aMaterial.mIconSet.mTextures[OrePrefixes.pipeNonuple.mTextureIndex],
- Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
- if (aPipeAmount >= 4)
- return TextureFactory.of(
- aMaterial.mIconSet.mTextures[OrePrefixes.pipeQuadruple.mTextureIndex],
- Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
- if (aThickNess < 0.124F)
- return TextureFactory.of(
- aMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex],
- Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
- if (aThickNess < 0.374F)
- return TextureFactory.of(
- aMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex],
- Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
- if (aThickNess < 0.499F)
- return TextureFactory.of(
- aMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex],
- Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
- if (aThickNess < 0.749F)
- return TextureFactory.of(
- aMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex],
- Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
- if (aThickNess < 0.874F)
- return TextureFactory.of(
- aMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex],
- Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
+ if (aPipeAmount >= 9) return TextureFactory.of(
+ aMaterial.mIconSet.mTextures[OrePrefixes.pipeNonuple.mTextureIndex],
+ Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
+ if (aPipeAmount >= 4) return TextureFactory.of(
+ aMaterial.mIconSet.mTextures[OrePrefixes.pipeQuadruple.mTextureIndex],
+ Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
+ if (aThickNess < 0.124F) return TextureFactory.of(
+ aMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex],
+ Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
+ if (aThickNess < 0.374F) return TextureFactory.of(
+ aMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex],
+ Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
+ if (aThickNess < 0.499F) return TextureFactory.of(
+ aMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex],
+ Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
+ if (aThickNess < 0.749F) return TextureFactory.of(
+ aMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex],
+ Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
+ if (aThickNess < 0.874F) return TextureFactory.of(
+ aMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex],
+ Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
return TextureFactory.of(
aMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex],
Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
@@ -277,9 +237,8 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
@Override
public void saveNBTData(NBTTagCompound aNBT) {
- for (int i = 0; i < mPipeAmount; i++)
- if (mFluids[i] != null)
- aNBT.setTag("mFluid" + (i == 0 ? "" : i), mFluids[i].writeToNBT(new NBTTagCompound()));
+ for (int i = 0; i < mPipeAmount; i++) if (mFluids[i] != null)
+ aNBT.setTag("mFluid" + (i == 0 ? "" : i), mFluids[i].writeToNBT(new NBTTagCompound()));
aNBT.setByte("mLastReceivedFrom", mLastReceivedFrom);
if (GT_Mod.gregtechproxy.gt6Pipe) {
aNBT.setByte("mConnections", mConnections);
@@ -305,17 +264,17 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
for (FluidStack tFluid : mFluids) {
if (tFluid != null) {
final int tTemperature = tFluid.getFluid().getTemperature(tFluid);
- if (tTemperature > 320
- && !isCoverOnSide(
- (BaseMetaPipeEntity) getBaseMetaTileEntity(), (EntityLivingBase) aEntity)) {
+ if (tTemperature > 320 && !isCoverOnSide(
+ (BaseMetaPipeEntity) getBaseMetaTileEntity(),
+ (EntityLivingBase) aEntity)) {
GT_Utility.applyHeatDamage((EntityLivingBase) aEntity, (tTemperature - 300) / 50.0F);
break;
- } else if (tTemperature < 260
- && !isCoverOnSide(
- (BaseMetaPipeEntity) getBaseMetaTileEntity(), (EntityLivingBase) aEntity)) {
- GT_Utility.applyFrostDamage((EntityLivingBase) aEntity, (270 - tTemperature) / 25.0F);
- break;
- }
+ } else if (tTemperature < 260 && !isCoverOnSide(
+ (BaseMetaPipeEntity) getBaseMetaTileEntity(),
+ (EntityLivingBase) aEntity)) {
+ GT_Utility.applyFrostDamage((EntityLivingBase) aEntity, (270 - tTemperature) / 25.0F);
+ break;
+ }
}
}
}
@@ -361,25 +320,33 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
// Poof
GT_Log.exp.println(
"Set Pipe to Fire due to to low heat resistance at " + aBaseMetaTileEntity.getXCoord()
- + " | " + aBaseMetaTileEntity.getYCoord() + " | " + aBaseMetaTileEntity.getZCoord()
- + " DIMID: " + aBaseMetaTileEntity.getWorld().provider.dimensionId);
+ + " | "
+ + aBaseMetaTileEntity.getYCoord()
+ + " | "
+ + aBaseMetaTileEntity.getZCoord()
+ + " DIMID: "
+ + aBaseMetaTileEntity.getWorld().provider.dimensionId);
aBaseMetaTileEntity.setToFire();
return true;
}
// Mmhmm, Fire
aBaseMetaTileEntity.setOnFire();
- GT_Log.exp.println("Set Blocks around Pipe to Fire due to to low heat resistance at "
- + aBaseMetaTileEntity.getXCoord() + " | " + aBaseMetaTileEntity.getYCoord() + " | "
- + aBaseMetaTileEntity.getZCoord() + " DIMID: "
- + aBaseMetaTileEntity.getWorld().provider.dimensionId);
+ GT_Log.exp.println(
+ "Set Blocks around Pipe to Fire due to to low heat resistance at "
+ + aBaseMetaTileEntity.getXCoord()
+ + " | "
+ + aBaseMetaTileEntity.getYCoord()
+ + " | "
+ + aBaseMetaTileEntity.getZCoord()
+ + " DIMID: "
+ + aBaseMetaTileEntity.getWorld().provider.dimensionId);
}
if (!mGasProof && tFluid.getFluid().isGaseous(tFluid)) {
tFluid.amount -= 5;
sendSound((byte) 9);
if (tTemperature > 320) {
try {
- for (EntityLivingBase tLiving : (ArrayList<EntityLivingBase>) getBaseMetaTileEntity()
- .getWorld()
+ for (EntityLivingBase tLiving : (ArrayList<EntityLivingBase>) getBaseMetaTileEntity().getWorld()
.getEntitiesWithinAABB(
EntityLivingBase.class,
AxisAlignedBB.getBoundingBox(
@@ -396,8 +363,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
}
} else if (tTemperature < 260) {
try {
- for (EntityLivingBase tLiving : (ArrayList<EntityLivingBase>) getBaseMetaTileEntity()
- .getWorld()
+ for (EntityLivingBase tLiving : (ArrayList<EntityLivingBase>) getBaseMetaTileEntity().getWorld()
.getEntitiesWithinAABB(
EntityLivingBase.class,
AxisAlignedBB.getBoundingBox(
@@ -434,8 +400,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
final IFluidHandler tTank = aBaseMetaTileEntity.getITankContainerAtSide(aSide);
final IGregTechTileEntity gTank = tTank instanceof IGregTechTileEntity ? (IGregTechTileEntity) tTank : null;
- if (isConnectedAtSide(aSide)
- && tTank != null
+ if (isConnectedAtSide(aSide) && tTank != null
&& (mLastReceivedFrom & (1 << aSide)) == 0
&& getBaseMetaTileEntity().getCoverInfoAtSide(aSide).letsFluidOut(tFluid.getFluid())
&& (gTank == null || gTank.getCoverInfoAtSide(tSide).letsFluidIn(tFluid.getFluid()))) {
@@ -470,8 +435,8 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
if (tEntry.right <= 0) continue;
- final int tFilledAmount =
- tEntry.left.fill(tEntry.middle, drainFromIndex(tEntry.right, false, index), false);
+ final int tFilledAmount = tEntry.left
+ .fill(tEntry.middle, drainFromIndex(tEntry.right, false, index), false);
if (tFilledAmount > 0) tEntry.left.fill(tEntry.middle, drainFromIndex(tFilledAmount, true, index), true);
@@ -480,8 +445,8 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
}
@Override
- public boolean onWrenchRightClick(
- byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY,
+ float aZ) {
if (GT_Mod.gregtechproxy.gt6Pipe) {
final byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ);
final byte tMask = (byte) (1 << tSide);
@@ -508,34 +473,26 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
}
@Override
- public boolean letsIn(
- GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ public boolean letsIn(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable,
+ ICoverable aTileEntity) {
return coverBehavior.letsFluidIn(aSide, aCoverID, aCoverVariable, null, aTileEntity);
}
@Override
- public boolean letsOut(
- GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ public boolean letsOut(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable,
+ ICoverable aTileEntity) {
return coverBehavior.letsFluidOut(aSide, aCoverID, aCoverVariable, null, aTileEntity);
}
@Override
- public boolean letsIn(
- GT_CoverBehaviorBase<?> coverBehavior,
- byte aSide,
- int aCoverID,
- ISerializableObject aCoverVariable,
- ICoverable aTileEntity) {
+ public boolean letsIn(GT_CoverBehaviorBase<?> coverBehavior, byte aSide, int aCoverID,
+ ISerializableObject aCoverVariable, ICoverable aTileEntity) {
return coverBehavior.letsFluidIn(aSide, aCoverID, aCoverVariable, null, aTileEntity);
}
@Override
- public boolean letsOut(
- GT_CoverBehaviorBase<?> coverBehavior,
- byte aSide,
- int aCoverID,
- ISerializableObject aCoverVariable,
- ICoverable aTileEntity) {
+ public boolean letsOut(GT_CoverBehaviorBase<?> coverBehavior, byte aSide, int aCoverID,
+ ISerializableObject aCoverVariable, ICoverable aTileEntity) {
return coverBehavior.letsFluidOut(aSide, aCoverID, aCoverVariable, null, aTileEntity);
}
@@ -553,14 +510,14 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
public boolean canConnect(byte aSide, TileEntity tTileEntity) {
if (tTileEntity == null) return false;
- final byte tSide =
- (byte) ForgeDirection.getOrientation(aSide).getOpposite().ordinal();
+ final byte tSide = (byte) ForgeDirection.getOrientation(aSide).getOpposite().ordinal();
final IGregTechTileEntity baseMetaTile = getBaseMetaTileEntity();
if (baseMetaTile == null) return false;
final GT_CoverBehaviorBase<?> coverBehavior = baseMetaTile.getCoverBehaviorAtSideNew(aSide);
- final IGregTechTileEntity gTileEntity =
- (tTileEntity instanceof IGregTechTileEntity) ? (IGregTechTileEntity) tTileEntity : null;
+ final IGregTechTileEntity gTileEntity = (tTileEntity instanceof IGregTechTileEntity)
+ ? (IGregTechTileEntity) tTileEntity
+ : null;
if (coverBehavior instanceof GT_Cover_Drain || (GregTech_API.mTConstruct && isTConstructFaucet(tTileEntity)))
return true;
@@ -570,8 +527,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
if (fTileEntity != null) {
final FluidTankInfo[] tInfo = fTileEntity.getTankInfo(ForgeDirection.getOrientation(tSide));
if (tInfo != null) {
- return tInfo.length > 0
- || (GregTech_API.mTranslocator && isTranslocator(tTileEntity))
+ return tInfo.length > 0 || (GregTech_API.mTranslocator && isTranslocator(tTileEntity))
|| gTileEntity != null
&& gTileEntity.getCoverBehaviorAtSideNew(tSide) instanceof GT_Cover_FluidRegulator;
}
@@ -603,18 +559,19 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
if (aIndex == 9) {
GT_Utility.doSoundAtClient(SoundResource.RANDOM_FIZZ, 5, 1.0F, aX, aY, aZ);
- new ParticleEventBuilder()
- .setIdentifier(ParticleFX.CLOUD)
- .setWorld(getBaseMetaTileEntity().getWorld())
- .<ParticleEventBuilder>times(6, (x, i) -> x.setMotion(
- ForgeDirection.getOrientation(i).offsetX / 5.0,
- ForgeDirection.getOrientation(i).offsetY / 5.0,
- ForgeDirection.getOrientation(i).offsetZ / 5.0)
- .setPosition(
- aX - 0.5 + XSTR_INSTANCE.nextFloat(),
- aY - 0.5 + XSTR_INSTANCE.nextFloat(),
- aZ - 0.5 + XSTR_INSTANCE.nextFloat())
- .run());
+ new ParticleEventBuilder().setIdentifier(ParticleFX.CLOUD).setWorld(getBaseMetaTileEntity().getWorld())
+ .<ParticleEventBuilder>times(
+ 6,
+ (x, i) -> x
+ .setMotion(
+ ForgeDirection.getOrientation(i).offsetX / 5.0,
+ ForgeDirection.getOrientation(i).offsetY / 5.0,
+ ForgeDirection.getOrientation(i).offsetZ / 5.0)
+ .setPosition(
+ aX - 0.5 + XSTR_INSTANCE.nextFloat(),
+ aY - 0.5 + XSTR_INSTANCE.nextFloat(),
+ aZ - 0.5 + XSTR_INSTANCE.nextFloat())
+ .run());
}
}
@@ -763,19 +720,25 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
public String[] getDescription() {
if (mPipeAmount == 1) {
return new String[] {
- EnumChatFormatting.BLUE + "Fluid Capacity: %%%" + GT_Utility.formatNumbers(mCapacity * 20L)
- + "%%% L/sec" + EnumChatFormatting.GRAY,
- EnumChatFormatting.RED + "Heat Limit: %%%" + GT_Utility.formatNumbers(mHeatResistance) + "%%% K"
- + EnumChatFormatting.GRAY
- };
+ EnumChatFormatting.BLUE + "Fluid Capacity: %%%"
+ + GT_Utility.formatNumbers(mCapacity * 20L)
+ + "%%% L/sec"
+ + EnumChatFormatting.GRAY,
+ EnumChatFormatting.RED + "Heat Limit: %%%"
+ + GT_Utility.formatNumbers(mHeatResistance)
+ + "%%% K"
+ + EnumChatFormatting.GRAY };
} else {
return new String[] {
- EnumChatFormatting.BLUE + "Fluid Capacity: %%%" + GT_Utility.formatNumbers(mCapacity * 20L)
- + "%%% L/sec" + EnumChatFormatting.GRAY,
- EnumChatFormatting.RED + "Heat Limit: %%%" + GT_Utility.formatNumbers(mHeatResistance) + "%%% K"
- + EnumChatFormatting.GRAY,
- EnumChatFormatting.AQUA + "Pipe Amount: %%%" + mPipeAmount + EnumChatFormatting.GRAY
- };
+ EnumChatFormatting.BLUE + "Fluid Capacity: %%%"
+ + GT_Utility.formatNumbers(mCapacity * 20L)
+ + "%%% L/sec"
+ + EnumChatFormatting.GRAY,
+ EnumChatFormatting.RED + "Heat Limit: %%%"
+ + GT_Utility.formatNumbers(mHeatResistance)
+ + "%%% K"
+ + EnumChatFormatting.GRAY,
+ EnumChatFormatting.AQUA + "Pipe Amount: %%%" + mPipeAmount + EnumChatFormatting.GRAY };
}
}
@@ -848,19 +811,13 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
if ((tConn & (1 << ForgeDirection.WEST.ordinal())) != 0) tSide4 = 0f;
if ((tConn & (1 << ForgeDirection.EAST.ordinal())) != 0) tSide5 = 1f;
- return AxisAlignedBB.getBoundingBox(
- aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3);
+ return AxisAlignedBB
+ .getBoundingBox(aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3);
}
@Override
- public void addCollisionBoxesToList(
- World aWorld,
- int aX,
- int aY,
- int aZ,
- AxisAlignedBB inputAABB,
- List<AxisAlignedBB> outputAABB,
- Entity collider) {
+ public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB,
+ List<AxisAlignedBB> outputAABB, Entity collider) {
super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider);
if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0) {
final AxisAlignedBB aabb = getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java
index d50c4fc165..e449921d1d 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java
@@ -3,6 +3,9 @@ package gregtech.api.metatileentity.implementations;
import static gregtech.api.enums.GT_Values.RA;
import static gregtech.api.util.GT_Utility.calculateRecipeEU;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
import gregtech.api.enums.*;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
@@ -13,12 +16,11 @@ import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_ModHandler.RecipeBits;
import gregtech.api.util.GT_OreDictUnificator;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
public class GT_MetaPipeEntity_Frame extends MetaPipeEntity {
- private static final String localizedDescFormat = GT_LanguageManager.addStringLocalization(
- "gt.blockmachines.gt_frame.desc.format", "Just something you can put covers on.");
+
+ private static final String localizedDescFormat = GT_LanguageManager
+ .addStringLocalization("gt.blockmachines.gt_frame.desc.format", "Just something you can put covers on.");
public final Materials mMaterial;
public GT_MetaPipeEntity_Frame(int aID, String aName, String aNameRegional, Materials aMaterial) {
@@ -30,7 +32,7 @@ public class GT_MetaPipeEntity_Frame extends MetaPipeEntity {
GT_ModHandler.addCraftingRecipe(
getStackForm(2),
RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.BUFFERED,
- new Object[] {"SSS", "SwS", "SSS", 'S', OrePrefixes.stick.get(mMaterial)});
+ new Object[] { "SSS", "SwS", "SSS", 'S', OrePrefixes.stick.get(mMaterial) });
}
if (!aMaterial.contains(SubTag.NO_RECIPES)) {
@@ -60,18 +62,11 @@ public class GT_MetaPipeEntity_Frame extends MetaPipeEntity {
}
@Override
- public ITexture[] getTexture(
- IGregTechTileEntity aBaseMetaTileEntity,
- byte aSide,
- byte aConnections,
- byte aColorIndex,
- boolean aConnected,
- boolean aRedstone) {
- return new ITexture[] {
- TextureFactory.of(
- mMaterial.mIconSet.mTextures[OrePrefixes.frameGt.mTextureIndex],
- Dyes.getModulation(aColorIndex, mMaterial.mRGBa))
- };
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections,
+ byte aColorIndex, boolean aConnected, boolean aRedstone) {
+ return new ITexture[] { TextureFactory.of(
+ mMaterial.mIconSet.mTextures[OrePrefixes.frameGt.mTextureIndex],
+ Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) };
}
@Override
@@ -106,23 +101,23 @@ public class GT_MetaPipeEntity_Frame extends MetaPipeEntity {
@Override
public final void saveNBTData(NBTTagCompound aNBT) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
public final void loadNBTData(NBTTagCompound aNBT) {
- /*Do nothing*/
+ /* Do nothing */
}
@Override
- public final boolean allowPutStack(
- IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ public final boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide,
+ ItemStack aStack) {
return false;
}
@Override
- public final boolean allowPullStack(
- IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ public final boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide,
+ ItemStack aStack) {
return false;
}
@@ -133,7 +128,7 @@ public class GT_MetaPipeEntity_Frame extends MetaPipeEntity {
@Override
public void disconnect(byte aSide) {
- /* Do nothing*/
+ /* Do nothing */
}
@Override
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java
index 5ae9150a58..5d2211528b 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java
@@ -3,6 +3,23 @@ package gregtech.api.metatileentity.implementations;
import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES;
import static gregtech.api.enums.Textures.BlockIcons.PIPE_RESTRICTOR;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.ISidedInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.tileentity.TileEntityDispenser;
+import net.minecraft.tileentity.TileEntityHopper;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+
import gregtech.GT_Mod;
import gregtech.api.enums.Dyes;
import gregtech.api.enums.GT_Values;
@@ -22,23 +39,9 @@ import gregtech.api.util.GT_Utility;
import gregtech.api.util.ISerializableObject;
import gregtech.common.GT_Client;
import gregtech.common.covers.CoverInfo;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.inventory.IInventory;
-import net.minecraft.inventory.ISidedInventory;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.tileentity.TileEntityDispenser;
-import net.minecraft.tileentity.TileEntityHopper;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.world.World;
-import net.minecraftforge.common.util.ForgeDirection;
public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileEntityItemPipe {
+
public final float mThickNess;
public final Materials mMaterial;
public final int mStepSize;
@@ -48,16 +51,8 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
public boolean mIsRestrictive = false;
private int[] cacheSides;
- public GT_MetaPipeEntity_Item(
- int aID,
- String aName,
- String aNameRegional,
- float aThickNess,
- Materials aMaterial,
- int aInvSlotCount,
- int aStepSize,
- boolean aIsRestrictive,
- int aTickTime) {
+ public GT_MetaPipeEntity_Item(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial,
+ int aInvSlotCount, int aStepSize, boolean aIsRestrictive, int aTickTime) {
super(aID, aName, aNameRegional, aInvSlotCount, false);
mIsRestrictive = aIsRestrictive;
mThickNess = aThickNess;
@@ -67,26 +62,13 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
addInfo(aID);
}
- public GT_MetaPipeEntity_Item(
- int aID,
- String aName,
- String aNameRegional,
- float aThickNess,
- Materials aMaterial,
- int aInvSlotCount,
- int aStepSize,
- boolean aIsRestrictive) {
+ public GT_MetaPipeEntity_Item(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial,
+ int aInvSlotCount, int aStepSize, boolean aIsRestrictive) {
this(aID, aName, aNameRegional, aThickNess, aMaterial, aInvSlotCount, aStepSize, aIsRestrictive, 20);
}
- public GT_MetaPipeEntity_Item(
- String aName,
- float aThickNess,
- Materials aMaterial,
- int aInvSlotCount,
- int aStepSize,
- boolean aIsRestrictive,
- int aTickTime) {
+ public GT_MetaPipeEntity_Item(String aName, float aThickNess, Materials aMaterial, int aInvSlotCount, int aStepSize,
+ boolean aIsRestrictive, int aTickTime) {
super(aName, aInvSlotCount);
mIsRestrictive = aIsRestrictive;
mThickNess = aThickNess;
@@ -103,112 +85,87 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
@Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MetaPipeEntity_Item(
- mName, mThickNess, mMaterial, mInventory.length, mStepSize, mIsRestrictive, mTickTime);
+ mName,
+ mThickNess,
+ mMaterial,
+ mInventory.length,
+ mStepSize,
+ mIsRestrictive,
+ mTickTime);
}
@Override
- public ITexture[] getTexture(
- IGregTechTileEntity aBaseMetaTileEntity,
- byte aSide,
- byte aConnections,
- byte aColorIndex,
- boolean aConnected,
- boolean aRedstone) {
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections,
+ byte aColorIndex, boolean aConnected, boolean aRedstone) {
if (mIsRestrictive) {
if (aConnected) {
float tThickNess = getThickNess();
if (tThickNess < 0.124F)
return new ITexture[] {
- TextureFactory.of(
- mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex],
- Dyes.getModulation(aColorIndex, mMaterial.mRGBa)),
- TextureFactory.of(PIPE_RESTRICTOR)
- };
+ TextureFactory.of(
+ mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex],
+ Dyes.getModulation(aColorIndex, mMaterial.mRGBa)),
+ TextureFactory.of(PIPE_RESTRICTOR) };
if (tThickNess < 0.374F) // 0.375
- return new ITexture[] {
- TextureFactory.of(
- mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex],
- Dyes.getModulation(aColorIndex, mMaterial.mRGBa)),
- TextureFactory.of(PIPE_RESTRICTOR)
- };
+ return new ITexture[] {
+ TextureFactory.of(
+ mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex],
+ Dyes.getModulation(aColorIndex, mMaterial.mRGBa)),
+ TextureFactory.of(PIPE_RESTRICTOR) };
if (tThickNess < 0.499F) // 0.500
- return new ITexture[] {
- TextureFactory.of(
- mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex],
- Dyes.getModulation(aColorIndex, mMaterial.mRGBa)),
- TextureFactory.of(PIPE_RESTRICTOR)
- };
+ return new ITexture[] {
+ TextureFactory.of(
+ mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex],
+ Dyes.getModulation(aColorIndex, mMaterial.mRGBa)),
+ TextureFactory.of(PIPE_RESTRICTOR) };
if (tThickNess < 0.749F) // 0.750
- return new ITexture[] {
- TextureFactory.of(
- mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex],
- Dyes.getModulation(aColorIndex, mMaterial.mRGBa)),
- TextureFactory.of(PIPE_RESTRICTOR)
- };
+ return new ITexture[] {
+ TextureFactory.of(
+ mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex],
+ Dyes.getModulation(aColorIndex, mMaterial.mRGBa)),
+ TextureFactory.of(PIPE_RESTRICTOR) };
if (tThickNess < 0.874F) // 0.825
- return new ITexture[] {
- TextureFactory.of(
- mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex],
- Dyes.getModulation(aColorIndex, mMaterial.mRGBa)),
- TextureFactory.of(PIPE_RESTRICTOR)
- };
- return new ITexture[] {
- TextureFactory.of(
- mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex],
- Dyes.getModulation(aColorIndex, mMaterial.mRGBa)),
- TextureFactory.of(PIPE_RESTRICTOR)
- };
+ return new ITexture[] {
+ TextureFactory.of(
+ mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex],
+ Dyes.getModulation(aColorIndex, mMaterial.mRGBa)),
+ TextureFactory.of(PIPE_RESTRICTOR) };
+ return new ITexture[] { TextureFactory.of(
+ mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex],
+ Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), TextureFactory.of(PIPE_RESTRICTOR) };
}
- return new ITexture[] {
- TextureFactory.of(
- mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex],
- Dyes.getModulation(aColorIndex, mMaterial.mRGBa)),
- TextureFactory.of(PIPE_RESTRICTOR)
- };
+ return new ITexture[] { TextureFactory.of(
+ mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex],
+ Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), TextureFactory.of(PIPE_RESTRICTOR) };
}
if (aConnected) {
float tThickNess = getThickNess();
- if (tThickNess < 0.124F)
- return new ITexture[] {
- TextureFactory.of(
- mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex],
- Dyes.getModulation(aColorIndex, mMaterial.mRGBa))
- };
+ if (tThickNess < 0.124F) return new ITexture[] { TextureFactory.of(
+ mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex],
+ Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) };
if (tThickNess < 0.374F) // 0.375
- return new ITexture[] {
- TextureFactory.of(
- mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex],
- Dyes.getModulation(aColorIndex, mMaterial.mRGBa))
- };
+ return new ITexture[] { TextureFactory.of(
+ mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex],
+ Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) };
if (tThickNess < 0.499F) // 0.500
- return new ITexture[] {
- TextureFactory.of(
- mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex],
- Dyes.getModulation(aColorIndex, mMaterial.mRGBa))
- };
+ return new ITexture[] { TextureFactory.of(
+ mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex],
+ Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) };
if (tThickNess < 0.749F) // 0.750
- return new ITexture[] {
- TextureFactory.of(
- mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex],
- Dyes.getModulation(aColorIndex, mMaterial.mRGBa))
- };
+ return new ITexture[] { TextureFactory.of(
+ mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex],
+ Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) };
if (tThickNess < 0.874F) // 0.825
- return new ITexture[] {
- TextureFactory.of(
- mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex],
- Dyes.getModulation(aColorIndex, mMaterial.mRGBa))
- };
- return new ITexture[] {
- TextureFactory.of(
- mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex],
- Dyes.getModulation(aColorIndex, mMaterial.mRGBa))
- };
+ return new ITexture[] { TextureFactory.of(
+ mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex],
+ Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) };
+ return new ITexture[] { TextureFactory.of(
+ mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex],
+ Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) };
}
- return new ITexture[] {
- TextureFactory.of(
- mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex],
- Dyes.getModulation(aColorIndex, mMaterial.mRGBa))
- };
+ return new ITexture[] { TextureFactory.of(
+ mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex],
+ Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) };
}
@Override
@@ -268,10 +225,11 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
final ArrayList<IMetaTileEntityItemPipe> tPipeList = new ArrayList<>();
- for (boolean temp = true; temp && !isInventoryEmpty() && pipeCapacityCheck(); ) {
+ for (boolean temp = true; temp && !isInventoryEmpty() && pipeCapacityCheck();) {
temp = false;
tPipeList.clear();
- for (IMetaTileEntityItemPipe tTileEntity : GT_Utility.sortMapByValuesAcending(
+ for (IMetaTileEntityItemPipe tTileEntity : GT_Utility
+ .sortMapByValuesAcending(
IMetaTileEntityItemPipe.Util.scanPipes(this, new HashMap<>(), 0, false, false))
.keySet()) {
if (temp) break;
@@ -289,8 +247,8 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
}
@Override
- public boolean onWrenchRightClick(
- byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY,
+ float aZ) {
if (GT_Mod.gregtechproxy.gt6Pipe) {
final byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ);
if (isConnectedAtSide(tSide)) {
@@ -305,34 +263,26 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
}
@Override
- public boolean letsIn(
- GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ public boolean letsIn(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable,
+ ICoverable aTileEntity) {
return coverBehavior.letsItemsIn(aSide, aCoverID, aCoverVariable, -1, aTileEntity);
}
@Override
- public boolean letsOut(
- GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ public boolean letsOut(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable,
+ ICoverable aTileEntity) {
return coverBehavior.letsItemsOut(aSide, aCoverID, aCoverVariable, -1, aTileEntity);
}
@Override
- public boolean letsIn(
- GT_CoverBehaviorBase<?> coverBehavior,
- byte aSide,
- int aCoverID,
- ISerializableObject aCoverVariable,
- ICoverable aTileEntity) {
+ public boolean letsIn(GT_CoverBehaviorBase<?> coverBehavior, byte aSide, int aCoverID,
+ ISerializableObject aCoverVariable, ICoverable aTileEntity) {
return coverBehavior.letsItemsIn(aSide, aCoverID, aCoverVariable, -1, aTileEntity);
}
@Override
- public boolean letsOut(
- GT_CoverBehaviorBase<?> coverBehavior,
- byte aSide,
- int aCoverID,
- ISerializableObject aCoverVariable,
- ICoverable aTileEntity) {
+ public boolean letsOut(GT_CoverBehaviorBase<?> coverBehavior, byte aSide, int aCoverID,
+ ISerializableObject aCoverVariable, ICoverable aTileEntity) {
return coverBehavior.letsItemsOut(aSide, aCoverID, aCoverVariable, -1, aTileEntity);
}
@@ -353,8 +303,9 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
final byte tSide = GT_Utility.getOppositeSide(aSide);
boolean connectable = GT_Utility.isConnectableNonInventoryPipe(tTileEntity, tSide);
- final IGregTechTileEntity gTileEntity =
- (tTileEntity instanceof IGregTechTileEntity) ? (IGregTechTileEntity) tTileEntity : null;
+ final IGregTechTileEntity gTileEntity = (tTileEntity instanceof IGregTechTileEntity)
+ ? (IGregTechTileEntity) tTileEntity
+ : null;
if (gTileEntity != null) {
if (gTileEntity.getMetaTileEntity() == null) return false;
if (gTileEntity.getMetaTileEntity().connectsToItemPipe(tSide)) return true;
@@ -410,18 +361,17 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
if ((!(tInventory instanceof TileEntityHopper) && !(tInventory instanceof TileEntityDispenser))
|| getBaseMetaTileEntity().getMetaIDAtSide(aSide) != GT_Utility.getOppositeSide(aSide)) {
return GT_Utility.moveMultipleItemStacks(
- aSender,
- tInventory,
- (byte) 6,
- GT_Utility.getOppositeSide(aSide),
- null,
- false,
- (byte) 64,
- (byte) 1,
- (byte) 64,
- (byte) 1,
- 1)
- > 0;
+ aSender,
+ tInventory,
+ (byte) 6,
+ GT_Utility.getOppositeSide(aSide),
+ null,
+ false,
+ (byte) 64,
+ (byte) 1,
+ (byte) 64,
+ (byte) 1,
+ 1) > 0;
}
}
}
@@ -490,21 +440,14 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
@Override
public String[] getDescription() {
- if (mTickTime == 20)
- return new String[] {
- "Item Capacity: %%%" + getMaxPipeCapacity() + "%%% Stacks/sec",
- "Routing Value: %%%" + GT_Utility.formatNumbers(mStepSize)
- };
- else if (mTickTime % 20 == 0)
- return new String[] {
+ if (mTickTime == 20) return new String[] { "Item Capacity: %%%" + getMaxPipeCapacity() + "%%% Stacks/sec",
+ "Routing Value: %%%" + GT_Utility.formatNumbers(mStepSize) };
+ else if (mTickTime % 20 == 0) return new String[] {
"Item Capacity: %%%" + getMaxPipeCapacity() + "%%% Stacks/%%%" + (mTickTime / 20) + "%%% sec",
- "Routing Value: %%%" + GT_Utility.formatNumbers(mStepSize)
- };
- else
- return new String[] {
+ "Routing Value: %%%" + GT_Utility.formatNumbers(mStepSize) };
+ else return new String[] {
"Item Capacity: %%%" + getMaxPipeCapacity() + "%%% Stacks/%%%" + mTickTime + "%%% ticks",
- "Routing Value: %%%" + GT_Utility.formatNumbers(mStepSize)
- };
+ "Routing Value: %%%" + GT_Utility.formatNumbers(mStepSize) };
}
private boolean isInventoryEmpty() {
@@ -567,19 +510,13 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
if ((tConn & (1 << ForgeDirection.WEST.ordinal())) != 0) tSide4 = 0f;
if ((tConn & (1 << ForgeDirection.EAST.ordinal())) != 0) tSide5 = 1f;
- return AxisAlignedBB.getBoundingBox(
- aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3);
+ return AxisAlignedBB
+ .getBoundingBox(aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3);
}
@Override
- public void addCollisionBoxesToList(
- World aWorld,
- int aX,
- int aY,
- int aZ,
- AxisAlignedBB inputAABB,
- List<AxisAlignedBB> outputAABB,
- Entity collider) {
+ public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB,
+ List<AxisAlignedBB> outputAABB, Entity collider) {
super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider);
if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0) {
final AxisAlignedBB aabb = getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java
index c46dbe0bae..7eb396a293 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java
@@ -2,10 +2,25 @@ package gregtech.api.metatileentity.implementations;
import static gregtech.api.enums.GT_Values.V;
+import java.util.List;
+
+import mcp.mobius.waila.api.IWailaConfigHandler;
+import mcp.mobius.waila.api.IWailaDataAccessor;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
import com.gtnewhorizons.modularui.common.internal.wrapper.BaseSlot;
import com.gtnewhorizons.modularui.common.widget.SlotGroup;
+
import gregtech.api.enums.Textures;
import gregtech.api.gui.modularui.GT_UIInfos;
import gregtech.api.interfaces.ITexture;
@@ -16,44 +31,34 @@ import gregtech.api.items.GT_MetaBase_Item;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Utility;
import ic2.api.item.IElectricItem;
-import java.util.List;
-import mcp.mobius.waila.api.IWailaConfigHandler;
-import mcp.mobius.waila.api.IWailaDataAccessor;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.util.StatCollector;
-import net.minecraft.world.World;
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
* <p/>
- * This is the main construct for my Basic Machines such as the Automatic Extractor
- * Extend this class to make a simple Machine
+ * This is the main construct for my Basic Machines such as the Automatic Extractor Extend this class to make a simple
+ * Machine
*/
public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_TieredMachineBlock
implements IAddUIWidgets {
+
public boolean mCharge = false, mDecharge = false;
public int mBatteryCount = 0, mChargeableCount = 0;
private long count = 0;
private long mStored = 0;
private long mMax = 0;
- public GT_MetaTileEntity_BasicBatteryBuffer(
- int aID, String aName, String aNameRegional, int aTier, String aDescription, int aSlotCount) {
+ public GT_MetaTileEntity_BasicBatteryBuffer(int aID, String aName, String aNameRegional, int aTier,
+ String aDescription, int aSlotCount) {
super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription);
}
- public GT_MetaTileEntity_BasicBatteryBuffer(
- String aName, int aTier, String aDescription, ITexture[][][] aTextures, int aSlotCount) {
+ public GT_MetaTileEntity_BasicBatteryBuffer(String aName, int aTier, String aDescription, ITexture[][][] aTextures,
+ int aSlotCount) {
super(aName, aTier, aSlotCount, aDescription, aTextures);
}
- public GT_MetaTileEntity_BasicBatteryBuffer(
- String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, int aSlotCount) {
+ public GT_MetaTileEntity_BasicBatteryBuffer(String aName, int aTier, String[] aDescription,
+ ITexture[][][] aTextures, int aSlotCount) {
super(aName, aTier, aSlotCount, aDescription, aTextures);
}
@@ -69,27 +74,18 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier
public ITexture[][][] getTextureSet(ITexture[] aTextures) {
ITexture[][][] rTextures = new ITexture[2][17][];
for (byte i = -1; i < 16; i++) {
- rTextures[0][i + 1] = new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1]};
- rTextures[1][i + 1] = new ITexture[] {
- Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
- mInventory.length == 16
- ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_POWER[mTier]
- : mInventory.length > 4
- ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]
- : Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]
- };
+ rTextures[0][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1] };
+ rTextures[1][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ mInventory.length == 16 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_POWER[mTier]
+ : mInventory.length > 4 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]
+ : Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] };
}
return rTextures;
}
@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) {
return mTextures[aSide == aFacing ? 1 : 0][aColorIndex + 1];
}
@@ -231,11 +227,10 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier
mDecharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3;
mBatteryCount = 0;
mChargeableCount = 0;
- for (ItemStack tStack : mInventory)
- if (GT_ModHandler.isElectricItem(tStack, mTier)) {
- if (GT_ModHandler.isChargerItem(tStack)) mBatteryCount++;
- mChargeableCount++;
- }
+ for (ItemStack tStack : mInventory) if (GT_ModHandler.isElectricItem(tStack, mTier)) {
+ if (GT_ModHandler.isChargerItem(tStack)) mBatteryCount++;
+ mChargeableCount++;
+ }
}
count++;
}
@@ -244,8 +239,7 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier
public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
if (GT_ModHandler.isElectricItem(aStack) && aStack.getUnlocalizedName().startsWith("gt.metaitem.01.")) {
String name = aStack.getUnlocalizedName();
- if (name.equals("gt.metaitem.01.32510")
- || name.equals("gt.metaitem.01.32511")
+ if (name.equals("gt.metaitem.01.32510") || name.equals("gt.metaitem.01.32511")
|| name.equals("gt.metaitem.01.32520")
|| name.equals("gt.metaitem.01.32521")
|| name.equals("gt.metaitem.01.32530")
@@ -310,23 +304,24 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier
if (storedOverflow) {
tStored = Long.MAX_VALUE;
}
- return new long[] {tStored, tScale};
+ return new long[] { tStored, tScale };
}
@Override
public String[] getInfoData() {
updateStorageInfo();
- return new String[] {
- EnumChatFormatting.BLUE + getLocalName() + EnumChatFormatting.RESET,
- "Stored Items:",
- EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mStored) + EnumChatFormatting.RESET + " EU / "
- + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mMax) + EnumChatFormatting.RESET + " EU",
- "Average input:",
- GT_Utility.formatNumbers(getBaseMetaTileEntity().getAverageElectricInput()) + " EU/t",
- "Average output:",
- GT_Utility.formatNumbers(getBaseMetaTileEntity().getAverageElectricOutput()) + " EU/t"
- };
+ return new String[] { EnumChatFormatting.BLUE + getLocalName() + EnumChatFormatting.RESET, "Stored Items:",
+ EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mStored)
+ + EnumChatFormatting.RESET
+ + " EU / "
+ + EnumChatFormatting.YELLOW
+ + GT_Utility.formatNumbers(mMax)
+ + EnumChatFormatting.RESET
+ + " EU",
+ "Average input:", GT_Utility.formatNumbers(getBaseMetaTileEntity().getAverageElectricInput()) + " EU/t",
+ "Average output:",
+ GT_Utility.formatNumbers(getBaseMetaTileEntity().getAverageElectricOutput()) + " EU/t" };
}
private void updateStorageInfo() {
@@ -339,29 +334,32 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier
}
@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) {
NBTTagCompound tag = accessor.getNBTData();
- currenttip.add(StatCollector.translateToLocalFormatted(
- "GT5U.waila.energy.stored",
- GT_Utility.formatNumbers(tag.getLong("mStored")),
- GT_Utility.formatNumbers(tag.getLong("mMax"))));
+ currenttip.add(
+ StatCollector.translateToLocalFormatted(
+ "GT5U.waila.energy.stored",
+ GT_Utility.formatNumbers(tag.getLong("mStored")),
+ GT_Utility.formatNumbers(tag.getLong("mMax"))));
long avgIn = tag.getLong("AvgIn");
long avgOut = tag.getLong("AvgOut");
- currenttip.add(StatCollector.translateToLocalFormatted(
- "GT5U.waila.energy.avg_in",
- GT_Utility.formatNumbers(avgIn),
- GT_Utility.getColoredTierNameFromVoltage(avgIn)));
- currenttip.add(StatCollector.translateToLocalFormatted(
- "GT5U.waila.energy.avg_out",
- GT_Utility.formatNumbers(avgOut),
- GT_Utility.getColoredTierNameFromVoltage(avgOut)));
+ currenttip.add(
+ StatCollector.translateToLocalFormatted(
+ "GT5U.waila.energy.avg_in",
+ GT_Utility.formatNumbers(avgIn),
+ GT_Utility.getColoredTierNameFromVoltage(avgIn)));
+ currenttip.add(
+ StatCollector.translateToLocalFormatted(
+ "GT5U.waila.energy.avg_out",
+ GT_Utility.formatNumbers(avgOut),
+ GT_Utility.getColoredTierNameFromVoltage(avgOut)));
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) {
updateStorageInfo();
super.getWailaNBTData(player, tile, tag, world, x, y, z);
tag.setLong("mStored", mStored);
@@ -384,60 +382,48 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier
public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) {
switch (mInventory.length) {
case 4:
- builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 2)
- .startFromSlot(0)
- .endAtSlot(3)
- .slotCreator(index -> new BaseSlot(inventoryHandler, index) {
- @Override
- public int getSlotStackLimit() {
- return 1;
- }
- })
- .background(getGUITextureSet().getItemSlot())
- .build()
- .setPos(70, 25));
+ builder.widget(
+ SlotGroup.ofItemHandler(inventoryHandler, 2).startFromSlot(0).endAtSlot(3)
+ .slotCreator(index -> new BaseSlot(inventoryHandler, index) {
+
+ @Override
+ public int getSlotStackLimit() {
+ return 1;
+ }
+ }).background(getGUITextureSet().getItemSlot()).build().setPos(70, 25));
break;
case 9:
- builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 3)
- .startFromSlot(0)
- .endAtSlot(8)
- .slotCreator(index -> new BaseSlot(inventoryHandler, index) {
- @Override
- public int getSlotStackLimit() {
- return 1;
- }
- })
- .background(getGUITextureSet().getItemSlot())
- .build()
- .setPos(61, 16));
+ builder.widget(
+ SlotGroup.ofItemHandler(inventoryHandler, 3).startFromSlot(0).endAtSlot(8)
+ .slotCreator(index -> new BaseSlot(inventoryHandler, index) {
+
+ @Override
+ public int getSlotStackLimit() {
+ return 1;
+ }
+ }).background(getGUITextureSet().getItemSlot()).build().setPos(61, 16));
break;
case 16:
- builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 4)
- .startFromSlot(0)
- .endAtSlot(15)
- .slotCreator(index -> new BaseSlot(inventoryHandler, index) {
- @Override
- public int getSlotStackLimit() {
- return 1;
- }
- })
- .background(getGUITextureSet().getItemSlot())
- .build()
- .setPos(52, 7));
+ builder.widget(
+ SlotGroup.ofItemHandler(inventoryHandler, 4).startFromSlot(0).endAtSlot(15)
+ .slotCreator(index -> new BaseSlot(inventoryHandler, index) {
+
+ @Override
+ public int getSlotStackLimit() {
+ return 1;
+ }
+ }).background(getGUITextureSet().getItemSlot()).build().setPos(52, 7));
break;
default:
- builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 1)
- .startFromSlot(0)
- .endAtSlot(0)
- .slotCreator(index -> new BaseSlot(inventoryHandler, index) {
- @Override
- public int getSlotStackLimit() {
- return 1;
- }
- })
- .background(getGUITextureSet().getItemSlot())
- .build()
- .setPos(79, 34));
+ builder.widget(
+ SlotGroup.ofItemHandler(inventoryHandler, 1).startFromSlot(0).endAtSlot(0)
+ .slotCreator(index -> new BaseSlot(inventoryHandler, index) {
+
+ @Override
+ public int getSlotStackLimit() {
+ return 1;
+ }
+ }).background(getGUITextureSet().getItemSlot()).build().setPos(79, 34));
break;
}
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java
index ca5f255302..669b3c9495 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java
@@ -2,6 +2,13 @@ package gregtech.api.metatileentity.implementations;
import static gregtech.api.enums.GT_Values.V;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.IFluidContainerItem;
+import net.minecraftforge.fluids.IFluidHandler;
+
import gregtech.api.enums.ItemList;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.enums.Textures;
@@ -14,21 +21,16 @@ import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
import gregtech.common.GT_Pollution;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Blocks;
-import net.minecraft.item.ItemStack;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.fluids.IFluidContainerItem;
-import net.minecraftforge.fluids.IFluidHandler;
public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity_BasicTank {
- public GT_MetaTileEntity_BasicGenerator(
- int aID, String aName, String aNameRegional, int aTier, String aDescription, ITexture... aTextures) {
+
+ public GT_MetaTileEntity_BasicGenerator(int aID, String aName, String aNameRegional, int aTier, String aDescription,
+ ITexture... aTextures) {
super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures);
}
- public GT_MetaTileEntity_BasicGenerator(
- int aID, String aName, String aNameRegional, int aTier, String[] aDescription, ITexture... aTextures) {
+ public GT_MetaTileEntity_BasicGenerator(int aID, String aName, String aNameRegional, int aTier,
+ String[] aDescription, ITexture... aTextures) {
super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures);
}
@@ -59,21 +61,11 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity
}
@Override
- public ITexture[] getTexture(
- IGregTechTileEntity aBaseMetaTileEntity,
- byte aSide,
- byte aFacing,
- byte aColorIndex,
- boolean aActive,
- boolean aRedstone) {
- return mTextures[
- (aActive ? 5 : 0)
- + (aSide == aFacing
- ? 0
- : aSide == GT_Utility.getOppositeSide(aFacing)
- ? 1
- : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][
- aColorIndex + 1];
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex,
+ boolean aActive, boolean aRedstone) {
+ return mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0
+ : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex
+ + 1];
}
@Override
@@ -91,23 +83,23 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity
}
public ITexture[] getFront(byte aColor) {
- return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]};
+ return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] };
}
public ITexture[] getBack(byte aColor) {
- return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]};
+ return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] };
}
public ITexture[] getBottom(byte aColor) {
- return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]};
+ return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] };
}
public ITexture[] getTop(byte aColor) {
- return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]};
+ return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] };
}
public ITexture[] getSides(byte aColor) {
- return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]};
+ return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] };
}
public ITexture[] getFrontActive(byte aColor) {
@@ -221,10 +213,11 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity
} else {
if (mInventory[getStackDisplaySlot()] == null)
mInventory[getStackDisplaySlot()] = new ItemStack(Blocks.fire, 1);
- mInventory[getStackDisplaySlot()].setStackDisplayName("Draining internal buffer: "
- + GT_Utility.formatNumbers(
- aBaseMetaTileEntity.getUniversalEnergyStored() - getMinimumStoredEU())
- + " EU");
+ mInventory[getStackDisplaySlot()].setStackDisplayName(
+ "Draining internal buffer: "
+ + GT_Utility.formatNumbers(
+ aBaseMetaTileEntity.getUniversalEnergyStored() - getMinimumStoredEU())
+ + " EU");
}
} else {
long tFuelValue = getFuelValue(mFluid), tConsumed = consumedFluidPerOperation(mFluid);
@@ -262,9 +255,9 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity
}
}
- if (aBaseMetaTileEntity.isServerSide())
- aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork()
- && aBaseMetaTileEntity.getUniversalEnergyStored() >= maxEUOutput() + getMinimumStoredEU());
+ if (aBaseMetaTileEntity.isServerSide()) aBaseMetaTileEntity.setActive(
+ aBaseMetaTileEntity.isAllowedToWork()
+ && aBaseMetaTileEntity.getUniversalEnergyStored() >= maxEUOutput() + getMinimumStoredEU());
}
/**
@@ -279,17 +272,14 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity
return !OrePrefixes.CELL_TYPES.contains(association.mPrefix)
&& !GT_Utility.areStacksEqual(ItemList.VOLUMETRIC_FLASK.get(1L), stack, true);
} else {
- return stack != null
- && // when the stack is null its not a solid
- stack.getItem() != null
- && // when the item in the stack is null its not a solid
- !(stack.getItem() instanceof IFluidContainerItem)
- && // when the item is a fluid container its not a solid...
- !(stack.getItem() instanceof IFluidHandler)
- && // when the item is a fluid handler its not a solid...
- !stack.getItem()
- .getUnlocalizedName()
- .contains("bucket"); // since we cant really check for buckets...
+ return stack != null && // when the stack is null its not a solid
+ stack.getItem() != null && // when the item in the stack is null its not a solid
+ !(stack.getItem() instanceof IFluidContainerItem) && // when the item is a fluid container its not a
+ // solid...
+ !(stack.getItem() instanceof IFluidHandler) && // when the item is a fluid handler its not a
+ // solid...
+ !stack.getItem().getUnlocalizedName().contains("bucket"); // since we cant really check for
+ // buckets...
}
}
@@ -341,9 +331,8 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity
@Override
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)
- && (getFuelValue(aStack, true) > 0
- || getFuelValue(GT_Utility.getFluidForFilledItem(aStack, true), true) > 0);
+ return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) && (getFuelValue(aStack, true) > 0
+ || getFuelValue(GT_Utility.getFluidForFilledItem(aStack, true), true) > 0);
}
@Override
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicHull.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicHull.java
index 31420386ee..cb9c670f05 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicHull.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicHull.java
@@ -2,37 +2,33 @@ package gregtech.api.metatileentity.implementations;
import static gregtech.api.enums.GT_Values.V;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
public class GT_MetaTileEntity_BasicHull extends GT_MetaTileEntity_BasicTank {
- public GT_MetaTileEntity_BasicHull(
- int aID, String aName, String aNameRegional, int aTier, String aDescription, ITexture... aTextures) {
+
+ public GT_MetaTileEntity_BasicHull(int aID, String aName, String aNameRegional, int aTier, String aDescription,
+ ITexture... aTextures) {
super(aID, aName, aNameRegional, aTier, 1, aDescription, aTextures);
}
- public GT_MetaTileEntity_BasicHull(
- int aID,
- String aName,
- String aNameRegional,
- int aTier,
- int aInvSlotCount,
- String aDescription,
- ITexture... aTextures) {
+ public GT_MetaTileEntity_BasicHull(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount,
+ String aDescription, ITexture... aTextures) {
super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures);
}
- public GT_MetaTileEntity_BasicHull(
- String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_BasicHull(String aName, int aTier, int aInvSlotCount, String aDescription,
+ ITexture[][][] aTextures) {
super(aName, aTier, aInvSlotCount, aDescription, aTextures);
}
- public GT_MetaTileEntity_BasicHull(
- String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_BasicHull(String aName, int aTier, int aInvSlotCount, String[] aDescription,
+ ITexture[][][] aTextures) {
super(aName, aTier, aInvSlotCount, aDescription, aTextures);
}
@@ -117,13 +113,8 @@ public class GT_MetaTileEntity_BasicHull extends GT_MetaTileEntity_BasicTank {
}
@Override
- public ITexture[] getTexture(
- IGregTechTileEntity aBaseMetaTileEntity,
- byte aSide,
- byte aFacing,
- byte aColorIndex,
- boolean aConnected,
- boolean aRedstone) {
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex,
+ boolean aConnected, boolean aRedstone) {
return mTextures[Math.min(2, aSide) + (aSide == aFacing ? 3 : 0)][aColorIndex + 1];
}
@@ -131,18 +122,15 @@ public class GT_MetaTileEntity_BasicHull extends GT_MetaTileEntity_BasicTank {
public ITexture[][][] getTextureSet(ITexture[] aTextures) {
ITexture[][][] rTextures = new ITexture[6][17][];
for (byte i = -1; i < 16; i++) {
- rTextures[0][i + 1] = new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1]};
- rTextures[1][i + 1] = new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1]};
- rTextures[2][i + 1] = new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1]};
- rTextures[3][i + 1] = new ITexture[] {
- Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]
- };
- rTextures[4][i + 1] = new ITexture[] {
- Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]
- };
- rTextures[5][i + 1] = new ITexture[] {
- Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]
- };
+ rTextures[0][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1] };
+ rTextures[1][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1] };
+ rTextures[2][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1] };
+ rTextures[3][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] };
+ rTextures[4][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] };
+ rTextures[5][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] };
}
return rTextures;
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicHull_NonElectric.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicHull_NonElectric.java
index 716d9d2c12..1296d846af 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicHull_NonElectric.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicHull_NonElectric.java
@@ -4,29 +4,25 @@ import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
public abstract class GT_MetaTileEntity_BasicHull_NonElectric extends GT_MetaTileEntity_BasicHull {
- public GT_MetaTileEntity_BasicHull_NonElectric(
- int aID, String aName, String aNameRegional, int aTier, String aDescription) {
+
+ public GT_MetaTileEntity_BasicHull_NonElectric(int aID, String aName, String aNameRegional, int aTier,
+ String aDescription) {
super(aID, aName, aNameRegional, aTier, aDescription);
}
- public GT_MetaTileEntity_BasicHull_NonElectric(
- String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_BasicHull_NonElectric(String aName, int aTier, String aDescription,
+ ITexture[][][] aTextures) {
super(aName, aTier, 1, aDescription, aTextures);
}
- public GT_MetaTileEntity_BasicHull_NonElectric(
- String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_BasicHull_NonElectric(String aName, int aTier, String[] aDescription,
+ ITexture[][][] aTextures) {
super(aName, aTier, 1, aDescription, aTextures);
}
@Override
- public ITexture[] getTexture(
- IGregTechTileEntity aBaseMetaTileEntity,
- byte aSide,
- byte aConnections,
- byte aColorIndex,
- boolean aConnected,
- boolean aRedstone) {
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections,
+ byte aColorIndex, boolean aConnected, boolean aRedstone) {
return mTextures[Math.min(2, aSide)][aColorIndex + 1];
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java
index 632b8cca8b..501e78ccec 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java
@@ -19,6 +19,29 @@ import static gregtech.api.metatileentity.BaseTileEntity.TOOLTIP_DELAY;
import static gregtech.api.metatileentity.BaseTileEntity.UNUSED_SLOT_TOOLTIP;
import static gregtech.api.util.GT_Utility.moveMultipleItemStacks;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import mcp.mobius.waila.api.IWailaConfigHandler;
+import mcp.mobius.waila.api.IWailaDataAccessor;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+import net.minecraftforge.common.DimensionManager;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.IFluidHandler;
+
+import org.apache.commons.lang3.tuple.Pair;
+
import com.gtnewhorizons.modularui.api.drawable.IDrawable;
import com.gtnewhorizons.modularui.api.drawable.UITexture;
import com.gtnewhorizons.modularui.api.math.Pos2d;
@@ -32,6 +55,7 @@ import com.gtnewhorizons.modularui.common.widget.DrawableWidget;
import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget;
import com.gtnewhorizons.modularui.common.widget.ProgressBar;
import com.gtnewhorizons.modularui.common.widget.SlotWidget;
+
import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.enums.ItemList;
@@ -55,31 +79,12 @@ import gregtech.common.gui.modularui.widget.FluidDisplaySlotWidget;
import gregtech.common.power.BasicMachineEUPower;
import gregtech.common.power.Power;
import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_Cleanroom;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import mcp.mobius.waila.api.IWailaConfigHandler;
-import mcp.mobius.waila.api.IWailaDataAccessor;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.util.StatCollector;
-import net.minecraft.world.World;
-import net.minecraftforge.common.DimensionManager;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.fluids.IFluidHandler;
-import org.apache.commons.lang3.tuple.Pair;
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
* <p/>
- * This is the main construct for my Basic Machines such as the Automatic Extractor
- * Extend this class to make a simple Machine
+ * This is the main construct for my Basic Machines such as the Automatic Extractor Extend this class to make a simple
+ * Machine
*/
public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_BasicTank
implements IConfigurationCircuitSupport, IAddGregtechLogo, IAddUIWidgets {
@@ -87,20 +92,14 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
/**
* return values for checkRecipe()
*/
- protected static final int DID_NOT_FIND_RECIPE = 0,
- FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS = 1,
+ protected static final int DID_NOT_FIND_RECIPE = 0, FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS = 1,
FOUND_AND_SUCCESSFULLY_USED_RECIPE = 2;
public static final int OTHER_SLOT_COUNT = 5;
public final ItemStack[] mOutputItems;
public final int mInputSlotCount, mAmperage;
- public boolean mAllowInputFromOutputSide = false,
- mFluidTransfer = false,
- mItemTransfer = false,
- mHasBeenUpdated = false,
- mStuttering = false,
- mCharge = false,
- mDecharge = false;
+ public boolean mAllowInputFromOutputSide = false, mFluidTransfer = false, mItemTransfer = false,
+ mHasBeenUpdated = false, mStuttering = false, mCharge = false, mDecharge = false;
public boolean mDisableFilter = true;
public boolean mDisableMultiStack = true;
public int mMainFacing = -1, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mOutputBlocked = 0;
@@ -109,40 +108,23 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
protected final Power mPower;
/**
- * Contains the Recipe which has been previously used, or null if there was no previous Recipe, which could have been buffered
+ * Contains the Recipe which has been previously used, or null if there was no previous Recipe, which could have
+ * been buffered
*/
protected GT_Recipe mLastRecipe = null;
private FluidStack mFluidOut;
/**
- * @param aOverlays 0 = SideFacingActive
- * 1 = SideFacingInactive
- * 2 = FrontFacingActive
- * 3 = FrontFacingInactive
- * 4 = TopFacingActive
- * 5 = TopFacingInactive
- * 6 = BottomFacingActive
- * 7 = BottomFacingInactive
- * ----- Not all Array Elements have to be initialised, you can also just use 8 Parameters for the Default Pipe Texture Overlays -----
- * 8 = BottomFacingPipeActive
- * 9 = BottomFacingPipeInactive
- * 10 = TopFacingPipeActive
- * 11 = TopFacingPipeInactive
- * 12 = SideFacingPipeActive
- * 13 = SideFacingPipeInactive
+ * @param aOverlays 0 = SideFacingActive 1 = SideFacingInactive 2 = FrontFacingActive 3 = FrontFacingInactive 4 =
+ * TopFacingActive 5 = TopFacingInactive 6 = BottomFacingActive 7 = BottomFacingInactive ----- Not
+ * all Array Elements have to be initialised, you can also just use 8 Parameters for the Default
+ * Pipe Texture Overlays ----- 8 = BottomFacingPipeActive 9 = BottomFacingPipeInactive 10 =
+ * TopFacingPipeActive 11 = TopFacingPipeInactive 12 = SideFacingPipeActive 13 =
+ * SideFacingPipeInactive
*/
- public GT_MetaTileEntity_BasicMachine(
- int aID,
- String aName,
- String aNameRegional,
- int aTier,
- int aAmperage,
- String aDescription,
- int aInputSlotCount,
- int aOutputSlotCount,
- String aGUIName,
- String aNEIName,
+ public GT_MetaTileEntity_BasicMachine(int aID, String aName, String aNameRegional, int aTier, int aAmperage,
+ String aDescription, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName,
ITexture... aOverlays) {
super(
aID,
@@ -160,17 +142,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
mPower = buildPower();
}
- public GT_MetaTileEntity_BasicMachine(
- int aID,
- String aName,
- String aNameRegional,
- int aTier,
- int aAmperage,
- String[] aDescription,
- int aInputSlotCount,
- int aOutputSlotCount,
- String aGUIName,
- String aNEIName,
+ public GT_MetaTileEntity_BasicMachine(int aID, String aName, String aNameRegional, int aTier, int aAmperage,
+ String[] aDescription, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName,
ITexture... aOverlays) {
super(
aID,
@@ -188,16 +161,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
mPower = buildPower();
}
- public GT_MetaTileEntity_BasicMachine(
- String aName,
- int aTier,
- int aAmperage,
- String aDescription,
- ITexture[][][] aTextures,
- int aInputSlotCount,
- int aOutputSlotCount,
- String aGUIName,
- String aNEIName) {
+ public GT_MetaTileEntity_BasicMachine(String aName, int aTier, int aAmperage, String aDescription,
+ ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName) {
super(aName, aTier, OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, aDescription, aTextures);
mInputSlotCount = Math.max(0, aInputSlotCount);
mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)];
@@ -207,16 +172,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
mPower = buildPower();
}
- public GT_MetaTileEntity_BasicMachine(
- String aName,
- int aTier,
- int aAmperage,
- String[] aDescription,
- ITexture[][][] aTextures,
- int aInputSlotCount,
- int aOutputSlotCount,
- String aGUIName,
- String aNEIName) {
+ public GT_MetaTileEntity_BasicMachine(String aName, int aTier, int aAmperage, String[] aDescription,
+ ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName) {
super(aName, aTier, OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, aDescription, aTextures);
mInputSlotCount = Math.max(0, aInputSlotCount);
mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)];
@@ -253,12 +210,10 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
ITexture[][][] rTextures = new ITexture[14][17][];
aTextures = Arrays.copyOf(aTextures, 14);
- for (int i = 0; i < aTextures.length; i++)
- if (aTextures[i] != null)
- for (byte c = -1; c < 16; c++) {
- if (rTextures[i][c + 1] == null)
- rTextures[i][c + 1] = new ITexture[] {MACHINE_CASINGS[mTier][c + 1], aTextures[i]};
- }
+ for (int i = 0; i < aTextures.length; i++) if (aTextures[i] != null) for (byte c = -1; c < 16; c++) {
+ if (rTextures[i][c + 1] == null)
+ rTextures[i][c + 1] = new ITexture[] { MACHINE_CASINGS[mTier][c + 1], aTextures[i] };
+ }
for (byte c = -1; c < 16; c++) {
if (rTextures[0][c + 1] == null) rTextures[0][c + 1] = getSideFacingActive(c);
@@ -280,28 +235,16 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
}
@Override
- public ITexture[] getTexture(
- IGregTechTileEntity aBaseMetaTileEntity,
- byte aSide,
- byte aFacing,
- byte aColorIndex,
- boolean aActive,
- boolean aRedstone) {
- return mTextures[
- mMainFacing < 2
- ? aSide == aFacing
- ? aActive ? 2 : 3
- : aSide == 0 ? aActive ? 6 : 7 : aSide == 1 ? aActive ? 4 : 5 : aActive ? 0 : 1
- : aSide == mMainFacing
- ? aActive ? 2 : 3
- : (showPipeFacing() && aSide == aFacing)
- ? aSide == 0
- ? aActive ? 8 : 9
- : aSide == 1 ? aActive ? 10 : 11 : aActive ? 12 : 13
- : aSide == 0
- ? aActive ? 6 : 7
- : aSide == 1 ? aActive ? 4 : 5 : aActive ? 0 : 1][
- aColorIndex + 1];
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex,
+ boolean aActive, boolean aRedstone) {
+ return mTextures[mMainFacing < 2
+ ? aSide == aFacing ? aActive ? 2 : 3
+ : aSide == 0 ? aActive ? 6 : 7 : aSide == 1 ? aActive ? 4 : 5 : aActive ? 0 : 1
+ : aSide == mMainFacing ? aActive ? 2 : 3
+ : (showPipeFacing() && aSide == aFacing)
+ ? aSide == 0 ? aActive ? 8 : 9 : aSide == 1 ? aActive ? 10 : 11 : aActive ? 12 : 13
+ : aSide == 0 ? aActive ? 6 : 7
+ : aSide == 1 ? aActive ? 4 : 5 : aActive ? 0 : 1][aColorIndex + 1];
}
@Override
@@ -326,8 +269,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
@Override
public boolean isValidSlot(int aIndex) {
- return aIndex > 0
- && super.isValidSlot(aIndex)
+ return aIndex > 0 && super.isValidSlot(aIndex)
&& aIndex != getCircuitSlot()
&& aIndex != OTHER_SLOT_COUNT + mInputSlotCount + mOutputItems.length;
}
@@ -359,9 +301,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
@Override
public boolean isLiquidInput(byte aSide) {
- return aSide != mMainFacing
- && (mAllowInputFromOutputSide
- || aSide != getBaseMetaTileEntity().getFrontFacing());
+ return aSide != mMainFacing && (mAllowInputFromOutputSide || aSide != getBaseMetaTileEntity().getFrontFacing());
}
@Override
@@ -456,8 +396,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
@Override
public boolean isFluidInputAllowed(FluidStack aFluid) {
- return getFillableStack() != null
- || (getRecipeList() != null && getRecipeList().containsInput(aFluid));
+ return getFillableStack() != null || (getRecipeList() != null && getRecipeList().containsInput(aFluid));
}
@Override
@@ -556,8 +495,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
aBaseMetaTileEntity,
getLocalName(),
mGUIName,
- GT_Utility.isStringValid(mNEIName)
- ? mNEIName
+ GT_Utility.isStringValid(mNEIName) ? mNEIName
: getRecipeList() != null ? getRecipeList().mUnlocalizedName : "");
}
@@ -565,8 +503,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
public void initDefaultModes(NBTTagCompound aNBT) {
mMainFacing = -1;
if (!getBaseMetaTileEntity().getWorld().isRemote) {
- GT_ClientPreference tPreference = GT_Mod.gregtechproxy.getClientPreference(
- getBaseMetaTileEntity().getOwnerUuid());
+ GT_ClientPreference tPreference = GT_Mod.gregtechproxy
+ .getClientPreference(getBaseMetaTileEntity().getOwnerUuid());
if (tPreference != null) {
mDisableFilter = !tPreference.isSingleBlockInitialFilterEnabled();
mDisableMultiStack = !tPreference.isSingleBlockInitialMultiStackEnabled();
@@ -631,9 +569,9 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
if (mProgresstime < 0 || drainEnergyForProcess(mEUt)) {
if (++mProgresstime >= mMaxProgresstime) {
for (int i = 0; i < mOutputItems.length; i++)
- for (int j = 0; j < mOutputItems.length; j++)
- if (aBaseMetaTileEntity.addStackToSlot(
- getOutputSlot() + ((j + i) % mOutputItems.length), mOutputItems[i])) break;
+ for (int j = 0; j < mOutputItems.length; j++) if (aBaseMetaTileEntity
+ .addStackToSlot(getOutputSlot() + ((j + i) % mOutputItems.length), mOutputItems[i]))
+ break;
if (mOutputFluid != null)
if (getDrainableStack() == null) setDrainableStack(mOutputFluid.copy());
else if (mOutputFluid.isFluidEqual(getDrainableStack()))
@@ -666,8 +604,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
boolean tRemovedOutputFluid = false;
- if (doesAutoOutputFluids()
- && getDrainableStack() != null
+ if (doesAutoOutputFluids() && getDrainableStack() != null
&& aBaseMetaTileEntity.getFrontFacing() != mMainFacing
&& (tSucceeded || aTick % 20 == 0)) {
IFluidHandler tTank = aBaseMetaTileEntity.getITankContainerAtSide(aBaseMetaTileEntity.getFrontFacing());
@@ -675,22 +612,21 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
FluidStack tDrained = drain(1000, false);
if (tDrained != null) {
int tFilledAmount = tTank.fill(
- ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), tDrained, false);
- if (tFilledAmount > 0)
- tTank.fill(
- ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()),
- drain(tFilledAmount, true),
- true);
+ ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()),
+ tDrained,
+ false);
+ if (tFilledAmount > 0) tTank.fill(
+ ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()),
+ drain(tFilledAmount, true),
+ true);
}
}
if (getDrainableStack() == null) tRemovedOutputFluid = true;
}
- if (doesAutoOutput()
- && !isOutputEmpty()
+ if (doesAutoOutput() && !isOutputEmpty()
&& aBaseMetaTileEntity.getFrontFacing() != mMainFacing
- && (tSucceeded
- || mOutputBlocked % 300 == 1
+ && (tSucceeded || mOutputBlocked % 300 == 1
|| aBaseMetaTileEntity.hasInventoryBeenModified()
|| aTick % 600 == 0)) {
TileEntity tTileEntity2 = aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getFrontFacing());
@@ -710,24 +646,21 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
(byte) 64,
(byte) 1,
tMaxStacks);
- // for (int i = 0, tCosts = 1; i < mOutputItems.length && tCosts > 0 &&
+ // for (int i = 0, tCosts = 1; i < mOutputItems.length && tCosts > 0 &&
// aBaseMetaTileEntity.isUniversalEnergyStored(128); i++) {
- // tCosts = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, tTileEntity2,
+ // tCosts = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, tTileEntity2,
// aBaseMetaTileEntity.getFrontFacing(), aBaseMetaTileEntity.getBackFacing(), null, false, (byte) 64,
// (byte) 1, (byte) 64, (byte) 1);
- // if (tCosts > 0) aBaseMetaTileEntity.decreaseStoredEnergyUnits(tCosts, true);
- // }
+ // if (tCosts > 0) aBaseMetaTileEntity.decreaseStoredEnergyUnits(tCosts, true);
+ // }
}
- if (mOutputBlocked != 0)
- if (isOutputEmpty()) mOutputBlocked = 0;
- else mOutputBlocked++;
+ if (mOutputBlocked != 0) if (isOutputEmpty()) mOutputBlocked = 0;
+ else mOutputBlocked++;
if (allowToCheckRecipe()) {
- if (mMaxProgresstime <= 0
- && aBaseMetaTileEntity.isAllowedToWork()
- && (tRemovedOutputFluid
- || tSucceeded
+ if (mMaxProgresstime <= 0 && aBaseMetaTileEntity.isAllowedToWork()
+ && (tRemovedOutputFluid || tSucceeded
|| aBaseMetaTileEntity.hasInventoryBeenModified()
|| aTick % 600 == 0
|| aBaseMetaTileEntity.hasWorkJustBeenEnabled())
@@ -764,11 +697,11 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
}
// Only using mNeedsSteamVenting right now and assigning it to 64 to space in the range for more single block
// machine problems.
- // Value | Class | Field
- // 1 | GT_MetaTileEntity_BasicMachine | mStuttering
- // 64 | GT_MetaTileEntity_BasicMachine_Bronze | mNeedsSteamVenting
- aBaseMetaTileEntity.setErrorDisplayID(
- (aBaseMetaTileEntity.getErrorDisplayID() & ~127)); // | (mStuttering ? 1 : 0));
+ // Value | Class | Field
+ // 1 | GT_MetaTileEntity_BasicMachine | mStuttering
+ // 64 | GT_MetaTileEntity_BasicMachine_Bronze | mNeedsSteamVenting
+ aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127)); // | (mStuttering ? 1 :
+ // 0));
}
protected void doDisplayThings() {
@@ -798,8 +731,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
if (ItemList.Display_Fluid.isStackEqual(mInventory[tDisplayStackSlot], true, true))
mInventory[tDisplayStackSlot] = null;
} else {
- mInventory[tDisplayStackSlot] =
- GT_Utility.getFluidDisplayStack(getFillableStack(), true, !displaysStackSize());
+ mInventory[tDisplayStackSlot] = GT_Utility
+ .getFluidDisplayStack(getFillableStack(), true, !displaysStackSize());
}
}
}
@@ -818,8 +751,9 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
/**
* Calcualtes overclocked ness using long integers
- * @param aEUt - recipe EUt
- * @param aDuration - recipe Duration
+ *
+ * @param aEUt - recipe EUt
+ * @param aDuration - recipe Duration
*/
protected void calculateOverclockedNess(int aEUt, int aDuration) {
mPower.computePowerUsageAndDuration(aEUt, aDuration);
@@ -842,32 +776,27 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
}
protected boolean canOutput(GT_Recipe aRecipe) {
- return aRecipe != null
- && (aRecipe.mNeedsEmptyOutput
- ? isOutputEmpty() && getDrainableStack() == null
- : canOutput(aRecipe.getFluidOutput(0)) && canOutput(aRecipe.mOutputs));
+ return aRecipe != null && (aRecipe.mNeedsEmptyOutput ? isOutputEmpty() && getDrainableStack() == null
+ : canOutput(aRecipe.getFluidOutput(0)) && canOutput(aRecipe.mOutputs));
}
protected boolean canOutput(ItemStack... aOutputs) {
if (aOutputs == null) return true;
ItemStack[] tOutputSlots = getAllOutputs();
for (int i = 0; i < tOutputSlots.length && i < aOutputs.length; i++)
- if (tOutputSlots[i] != null
- && aOutputs[i] != null
+ if (tOutputSlots[i] != null && aOutputs[i] != null
&& (!GT_Utility.areStacksEqual(tOutputSlots[i], aOutputs[i], false)
|| tOutputSlots[i].stackSize + aOutputs[i].stackSize > tOutputSlots[i].getMaxStackSize())) {
- mOutputBlocked++;
- return false;
- }
+ mOutputBlocked++;
+ return false;
+ }
return true;
}
protected boolean canOutput(FluidStack aOutput) {
- return getDrainableStack() == null
- || aOutput == null
- || (getDrainableStack().isFluidEqual(aOutput)
- && (getDrainableStack().amount <= 0
- || getDrainableStack().amount + aOutput.amount <= getCapacity()));
+ return getDrainableStack() == null || aOutput == null
+ || (getDrainableStack().isFluidEqual(aOutput) && (getDrainableStack().amount <= 0
+ || getDrainableStack().amount + aOutput.amount <= getCapacity()));
}
protected ItemStack getInputAt(int aIndex) {
@@ -884,11 +813,10 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
protected boolean isOutputEmpty() {
boolean rIsEmpty = true;
- for (ItemStack tOutputSlotContent : getAllOutputs())
- if (tOutputSlotContent != null) {
- rIsEmpty = false;
- break;
- }
+ for (ItemStack tOutputSlotContent : getAllOutputs()) if (tOutputSlotContent != null) {
+ rIsEmpty = false;
+ break;
+ }
return rIsEmpty;
}
@@ -973,22 +901,30 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
@Override
public String[] getInfoData() {
- return new String[] {
- EnumChatFormatting.BLUE + mNEIName + EnumChatFormatting.RESET,
- "Progress:",
- EnumChatFormatting.GREEN + GT_Utility.formatNumbers((mProgresstime / 20)) + EnumChatFormatting.RESET
- + " s / " + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mMaxProgresstime / 20)
- + EnumChatFormatting.RESET + " s",
- "Stored Energy:",
- EnumChatFormatting.GREEN
- + GT_Utility.formatNumbers(getBaseMetaTileEntity().getStoredEU()) + EnumChatFormatting.RESET
- + " EU / " + EnumChatFormatting.YELLOW
- + GT_Utility.formatNumbers(getBaseMetaTileEntity().getEUCapacity()) + EnumChatFormatting.RESET
- + " EU",
- "Probably uses: " + EnumChatFormatting.RED
- + GT_Utility.formatNumbers(mEUt) + EnumChatFormatting.RESET + " EU/t at " + EnumChatFormatting.RED
- + GT_Utility.formatNumbers(mEUt == 0 ? 0 : mAmperage) + EnumChatFormatting.RESET + " A"
- };
+ return new String[] { EnumChatFormatting.BLUE + mNEIName + EnumChatFormatting.RESET, "Progress:",
+ EnumChatFormatting.GREEN + GT_Utility.formatNumbers((mProgresstime / 20))
+ + EnumChatFormatting.RESET
+ + " s / "
+ + EnumChatFormatting.YELLOW
+ + GT_Utility.formatNumbers(mMaxProgresstime / 20)
+ + EnumChatFormatting.RESET
+ + " s",
+ "Stored Energy:",
+ EnumChatFormatting.GREEN + GT_Utility.formatNumbers(getBaseMetaTileEntity().getStoredEU())
+ + EnumChatFormatting.RESET
+ + " EU / "
+ + EnumChatFormatting.YELLOW
+ + GT_Utility.formatNumbers(getBaseMetaTileEntity().getEUCapacity())
+ + EnumChatFormatting.RESET
+ + " EU",
+ "Probably uses: " + EnumChatFormatting.RED
+ + GT_Utility.formatNumbers(mEUt)
+ + EnumChatFormatting.RESET
+ + " EU/t at "
+ + EnumChatFormatting.RED
+ + GT_Utility.formatNumbers(mEUt == 0 ? 0 : mAmperage)
+ + EnumChatFormatting.RESET
+ + " A" };
}
@Override
@@ -1002,28 +938,29 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
if (aPlayer.isSneaking()) {
mDisableFilter = !mDisableFilter;
GT_Utility.sendChatToPlayer(
- aPlayer, StatCollector.translateToLocal("GT5U.hatch.disableFilter." + mDisableFilter));
+ aPlayer,
+ StatCollector.translateToLocal("GT5U.hatch.disableFilter." + mDisableFilter));
} else {
mAllowInputFromOutputSide = !mAllowInputFromOutputSide;
GT_Utility.sendChatToPlayer(
aPlayer,
- mAllowInputFromOutputSide
- ? GT_Utility.trans("095", "Input from Output Side allowed")
+ mAllowInputFromOutputSide ? GT_Utility.trans("095", "Input from Output Side allowed")
: GT_Utility.trans("096", "Input from Output Side forbidden"));
}
}
}
@Override
- public boolean onSolderingToolRightClick(
- byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY,
+ float aZ) {
if (!aPlayer.isSneaking()) return false;
boolean click = super.onSolderingToolRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ);
if (click) return true;
if (aWrenchingSide != mMainFacing) return false;
mDisableMultiStack = !mDisableMultiStack;
GT_Utility.sendChatToPlayer(
- aPlayer, StatCollector.translateToLocal("GT5U.hatch.disableMultiStack." + mDisableMultiStack));
+ aPlayer,
+ StatCollector.translateToLocal("GT5U.hatch.disableMultiStack." + mDisableMultiStack));
return true;
}
@@ -1045,10 +982,10 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
@Override
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- if (aSide == mMainFacing
- || aIndex < getInputSlot()
+ if (aSide == mMainFacing || aIndex < getInputSlot()
|| aIndex >= getInputSlot() + mInputSlotCount
- || (!mAllowInputFromOutputSide && aSide == aBaseMetaTileEntity.getFrontFacing())) return false;
+ || (!mAllowInputFromOutputSide && aSide == aBaseMetaTileEntity.getFrontFacing()))
+ return false;
for (int i = getInputSlot(), j = i + mInputSlotCount; i < j; i++)
if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(aStack), mInventory[i]) && mDisableMultiStack)
return i == aIndex;
@@ -1056,12 +993,12 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
}
/**
- * Test if given stack can be inserted into specified slot.
- * If mDisableMultiStack is false, before execution of this method it is ensured there is no such kind of item inside any input slots already.
- * Otherwise, you don't need to check for it anyway.
+ * Test if given stack can be inserted into specified slot. If mDisableMultiStack is false, before execution of this
+ * method it is ensured there is no such kind of item inside any input slots already. Otherwise, you don't need to
+ * check for it anyway.
*/
- protected boolean allowPutStackValidated(
- IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide,
+ ItemStack aStack) {
return !mDisableMultiStack || mInventory[aIndex] == null;
}
@@ -1105,7 +1042,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
}
/**
- * Override this to check the Recipes yourself, super calls to this could be useful if you just want to add a special case
+ * Override this to check the Recipes yourself, super calls to this could be useful if you just want to add a
+ * special case
* <p/>
* I thought about Enum too, but Enum doesn't add support for people adding other return Systems.
* <p/>
@@ -1129,8 +1067,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
/**
*
* @param skipOC disables OverclockedNess calculation and check - if you do you must implement your own method...
- * @return DID_NOT_FIND_RECIPE = 0,
- * FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS = 1,
+ * @return DID_NOT_FIND_RECIPE = 0, FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS = 1,
* FOUND_AND_SUCCESSFULLY_USED_RECIPE = 2;
*/
public int checkRecipe(boolean skipOC) {
@@ -1141,13 +1078,12 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
mLastRecipe,
false,
V[mTier],
- new FluidStack[] {getFillableStack()},
+ new FluidStack[] { getFillableStack() },
getSpecialSlot(),
getAllInputs());
if (tRecipe == null) return DID_NOT_FIND_RECIPE;
- if (GT_Mod.gregtechproxy.mLowGravProcessing
- && (tRecipe.mSpecialValue == -100 || tRecipe.mSpecialValue == -300)
+ if (GT_Mod.gregtechproxy.mLowGravProcessing && (tRecipe.mSpecialValue == -100 || tRecipe.mSpecialValue == -300)
&& !isValidForLowGravity(tRecipe, getBaseMetaTileEntity().getWorld().provider.dimensionId))
return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
if (tRecipe.mCanBeBuffered) mLastRecipe = tRecipe;
@@ -1156,26 +1092,25 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
}
if (tRecipe.mSpecialValue == -200
- && (getCallbackBase() == null
- || !(getCallbackBase() instanceof GT_MetaTileEntity_Cleanroom)
+ && (getCallbackBase() == null || !(getCallbackBase() instanceof GT_MetaTileEntity_Cleanroom)
|| ((GT_MetaTileEntity_Cleanroom) getCallbackBase()).mEfficiency == 0))
return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
- if (!tRecipe.isRecipeInputEqual(true, new FluidStack[] {getFillableStack()}, getAllInputs()))
+ if (!tRecipe.isRecipeInputEqual(true, new FluidStack[] { getFillableStack() }, getAllInputs()))
return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
for (int i = 0; i < mOutputItems.length; i++)
if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(i))
mOutputItems[i] = tRecipe.getOutput(i);
if (tRecipe.mSpecialValue == -200 || tRecipe.mSpecialValue == -300)
for (int i = 0; i < mOutputItems.length; i++)
- if (mOutputItems[i] != null
- && getBaseMetaTileEntity().getRandomNumber(10000)
- > ((GT_MetaTileEntity_Cleanroom) getCallbackBase()).mEfficiency) {
- if (debugCleanroom) {
- GT_Log.out.println("BasicMachine: Voiding output due to efficiency failure. mEfficiency = "
- + ((GT_MetaTileEntity_Cleanroom) getCallbackBase()).mEfficiency);
- }
- mOutputItems[i] = null;
- }
+ if (mOutputItems[i] != null && getBaseMetaTileEntity().getRandomNumber(10000)
+ > ((GT_MetaTileEntity_Cleanroom) getCallbackBase()).mEfficiency) {
+ if (debugCleanroom) {
+ GT_Log.out.println(
+ "BasicMachine: Voiding output due to efficiency failure. mEfficiency = "
+ + ((GT_MetaTileEntity_Cleanroom) getCallbackBase()).mEfficiency);
+ }
+ mOutputItems[i] = null;
+ }
mOutputFluid = tRecipe.getFluidOutput(0);
if (!skipOC) {
calculateOverclockedNess(tRecipe);
@@ -1187,64 +1122,64 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
}
public ITexture[] getSideFacingActive(byte aColor) {
- return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1]};
+ return new ITexture[] { MACHINE_CASINGS[mTier][aColor + 1] };
}
public ITexture[] getSideFacingInactive(byte aColor) {
- return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1]};
+ return new ITexture[] { MACHINE_CASINGS[mTier][aColor + 1] };
}
public ITexture[] getFrontFacingActive(byte aColor) {
- return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1]};
+ return new ITexture[] { MACHINE_CASINGS[mTier][aColor + 1] };
}
public ITexture[] getFrontFacingInactive(byte aColor) {
- return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1]};
+ return new ITexture[] { MACHINE_CASINGS[mTier][aColor + 1] };
}
public ITexture[] getTopFacingActive(byte aColor) {
- return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1]};
+ return new ITexture[] { MACHINE_CASINGS[mTier][aColor + 1] };
}
public ITexture[] getTopFacingInactive(byte aColor) {
- return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1]};
+ return new ITexture[] { MACHINE_CASINGS[mTier][aColor + 1] };
}
public ITexture[] getBottomFacingActive(byte aColor) {
- return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1]};
+ return new ITexture[] { MACHINE_CASINGS[mTier][aColor + 1] };
}
public ITexture[] getBottomFacingInactive(byte aColor) {
- return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1]};
+ return new ITexture[] { MACHINE_CASINGS[mTier][aColor + 1] };
}
public ITexture[] getBottomFacingPipeActive(byte aColor) {
- return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)};
+ return new ITexture[] { MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT) };
}
public ITexture[] getBottomFacingPipeInactive(byte aColor) {
- return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)};
+ return new ITexture[] { MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT) };
}
public ITexture[] getTopFacingPipeActive(byte aColor) {
- return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)};
+ return new ITexture[] { MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT) };
}
public ITexture[] getTopFacingPipeInactive(byte aColor) {
- return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)};
+ return new ITexture[] { MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT) };
}
public ITexture[] getSideFacingPipeActive(byte aColor) {
- return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)};
+ return new ITexture[] { MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT) };
}
public ITexture[] getSideFacingPipeInactive(byte aColor) {
- return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)};
+ return new ITexture[] { MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT) };
}
@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();
if (tag.getBoolean("stutteringSingleBlock")) {
@@ -1254,35 +1189,40 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
if (isActive) {
int mEUt = tag.getInteger("eut");
if (mEUt > 0) {
- currenttip.add(StatCollector.translateToLocalFormatted(
- "GT5U.waila.energy.use",
- GT_Utility.formatNumbers(mEUt),
- GT_Utility.getColoredTierNameFromVoltage(mEUt)));
+ currenttip.add(
+ StatCollector.translateToLocalFormatted(
+ "GT5U.waila.energy.use",
+ GT_Utility.formatNumbers(mEUt),
+ GT_Utility.getColoredTierNameFromVoltage(mEUt)));
} else if (mEUt < 0) {
- currenttip.add(StatCollector.translateToLocalFormatted(
- "GT5U.waila.energy.produce",
- GT_Utility.formatNumbers(-mEUt),
- GT_Utility.getColoredTierNameFromVoltage(-mEUt)));
+ currenttip.add(
+ StatCollector.translateToLocalFormatted(
+ "GT5U.waila.energy.produce",
+ GT_Utility.formatNumbers(-mEUt),
+ GT_Utility.getColoredTierNameFromVoltage(-mEUt)));
}
}
- currenttip.add(GT_Waila.getMachineProgressString(
- isActive, tag.getInteger("maxProgressSingleBlock"), tag.getInteger("progressSingleBlock")));
+ currenttip.add(
+ GT_Waila.getMachineProgressString(
+ isActive,
+ tag.getInteger("maxProgressSingleBlock"),
+ tag.getInteger("progressSingleBlock")));
}
- currenttip.add(String.format(
- "Machine Facing: %s",
- ForgeDirection.getOrientation(tag.getInteger("mainFacingSingleBlock"))
- .name()));
+ currenttip.add(
+ String.format(
+ "Machine Facing: %s",
+ ForgeDirection.getOrientation(tag.getInteger("mainFacingSingleBlock")).name()));
- currenttip.add(String.format(
- "Output Facing: %s",
- ForgeDirection.getOrientation(tag.getInteger("outputFacingSingleBlock"))
- .name()));
+ currenttip.add(
+ String.format(
+ "Output Facing: %s",
+ ForgeDirection.getOrientation(tag.getInteger("outputFacingSingleBlock")).name()));
}
@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.setInteger("progressSingleBlock", mProgresstime);
@@ -1324,10 +1264,9 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
if (getRecipeList() != null) {
getRecipeList().addGregTechLogoUI(builder, new Pos2d(0, 0));
} else {
- builder.widget(new DrawableWidget()
- .setDrawable(getGUITextureSet().getGregTechLogo())
- .setSize(17, 17)
- .setPos(152, 63));
+ builder.widget(
+ new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()).setSize(17, 17)
+ .setPos(152, 63));
}
}
@@ -1342,31 +1281,32 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
builder.widget(createChargerSlot(79, 62));
if (getRecipeList() != null) {
- builder.widget(setNEITransferRect(
- createProgressBar(
- isSteampowered()
- ? getRecipeList().getProgressBarTextureSteam(getSteamVariant())
- : getRecipeList().getProgressBarTexture(),
- getRecipeList().getProgressBarImageSize(),
- getRecipeList().progressBarDirection,
- getRecipeList().progressBarPos,
- getRecipeList().progressBarSize),
- getRecipeList().mNEIName));
+ builder.widget(
+ setNEITransferRect(
+ createProgressBar(
+ isSteampowered() ? getRecipeList().getProgressBarTextureSteam(getSteamVariant())
+ : getRecipeList().getProgressBarTexture(),
+ getRecipeList().getProgressBarImageSize(),
+ getRecipeList().progressBarDirection,
+ getRecipeList().progressBarPos,
+ getRecipeList().progressBarSize),
+ getRecipeList().mNEIName));
addProgressBarSpecialTextures(builder);
}
- builder.widget(createErrorStatusArea(
- builder,
- isSteampowered() ? GT_UITextures.PICTURE_STALLED_STEAM : GT_UITextures.PICTURE_STALLED_ELECTRICITY));
+ builder.widget(
+ createErrorStatusArea(
+ builder,
+ isSteampowered() ? GT_UITextures.PICTURE_STALLED_STEAM
+ : GT_UITextures.PICTURE_STALLED_ELECTRICITY));
}
/**
* Adds item I/O, special item, and fluid I/O slots.
*/
protected void addIOSlots(ModularWindow.Builder builder) {
- final boolean hasFluidInput =
- getRecipeList() != null ? (getRecipeList().hasFluidInputs()) : (getCapacity() != 0);
- final boolean hasFluidOutput =
- getRecipeList() != null && getRecipeList().hasFluidOutputs();
+ final boolean hasFluidInput = getRecipeList() != null ? (getRecipeList().hasFluidInputs())
+ : (getCapacity() != 0);
+ final boolean hasFluidOutput = getRecipeList() != null && getRecipeList().hasFluidOutputs();
UIHelper.forEachSlots(
(i, backgrounds, pos) -> builder.widget(createItemInputSlot(i, backgrounds, pos)),
(i, backgrounds, pos) -> builder.widget(createItemOutputSlot(i, backgrounds, pos)),
@@ -1388,59 +1328,48 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
* Override this as needed instead of calling.
*/
protected SlotWidget createItemInputSlot(int index, IDrawable[] backgrounds, Pos2d pos) {
- return (SlotWidget) new SlotWidget(inventoryHandler, getInputSlot() + index)
- .setAccess(true, true)
- .setBackground(backgrounds)
- .setPos(pos);
+ return (SlotWidget) new SlotWidget(inventoryHandler, getInputSlot() + index).setAccess(true, true)
+ .setBackground(backgrounds).setPos(pos);
}
/**
* Override this as needed instead of calling.
*/
protected SlotWidget createItemOutputSlot(int index, IDrawable[] backgrounds, Pos2d pos) {
- return (SlotWidget) new SlotWidget(inventoryHandler, getOutputSlot() + index)
- .setAccess(true, false)
- .setBackground(backgrounds)
- .setPos(pos);
+ return (SlotWidget) new SlotWidget(inventoryHandler, getOutputSlot() + index).setAccess(true, false)
+ .setBackground(backgrounds).setPos(pos);
}
/**
* Override this as needed instead of calling.
*/
protected SlotWidget createSpecialSlot(IDrawable[] backgrounds, Pos2d pos) {
- return (SlotWidget) new SlotWidget(inventoryHandler, getSpecialSlotIndex())
- .setAccess(true, true)
+ return (SlotWidget) new SlotWidget(inventoryHandler, getSpecialSlotIndex()).setAccess(true, true)
.disableShiftInsert()
- .setGTTooltip(() -> mTooltipCache.getData(
- getRecipeList() != null && getRecipeList().usesSpecialSlot()
- ? SPECIAL_SLOT_TOOLTIP
- : UNUSED_SLOT_TOOLTIP))
- .setTooltipShowUpDelay(TOOLTIP_DELAY)
- .setBackground(backgrounds)
- .setPos(pos);
+ .setGTTooltip(
+ () -> mTooltipCache.getData(
+ getRecipeList() != null && getRecipeList().usesSpecialSlot() ? SPECIAL_SLOT_TOOLTIP
+ : UNUSED_SLOT_TOOLTIP))
+ .setTooltipShowUpDelay(TOOLTIP_DELAY).setBackground(backgrounds).setPos(pos);
}
protected FluidDisplaySlotWidget createFluidInputSlot(IDrawable[] backgrounds, Pos2d pos) {
return (FluidDisplaySlotWidget) new FluidDisplaySlotWidget(
- inventoryHandler, OTHER_SLOT_COUNT + mInputSlotCount + mOutputItems.length)
- .setFluidAccessConstructor(() -> constructFluidAccess(true))
- .setIHasFluidDisplay(this)
- .setCanDrain(true)
- .setCanFill(true)
- .setActionRealClick(FluidDisplaySlotWidget.Action.TRANSFER)
- .setBeforeRealClick((clickData, widget) -> {
- if (NetworkUtils.isClient()) {
- // propagate display item content to actual fluid stored in this tank
- setFillableStack(GT_Utility.getFluidFromDisplayStack(
- widget.getMcSlot().getStack()));
- }
- return true;
- })
- .setUpdateFluidDisplayItem(this::updateFluidInputDisplayItem)
- .setGTTooltip(() -> mTooltipCache.getData(FLUID_INPUT_TOOLTIP, GT_Utility.formatNumbers(getCapacity())))
- .setTooltipShowUpDelay(TOOLTIP_DELAY)
- .setBackground(backgrounds)
- .setPos(pos);
+ inventoryHandler,
+ OTHER_SLOT_COUNT + mInputSlotCount + mOutputItems.length)
+ .setFluidAccessConstructor(() -> constructFluidAccess(true)).setIHasFluidDisplay(this)
+ .setCanDrain(true).setCanFill(true).setActionRealClick(FluidDisplaySlotWidget.Action.TRANSFER)
+ .setBeforeRealClick((clickData, widget) -> {
+ if (NetworkUtils.isClient()) {
+ // propagate display item content to actual fluid stored in this tank
+ setFillableStack(GT_Utility.getFluidFromDisplayStack(widget.getMcSlot().getStack()));
+ }
+ return true;
+ }).setUpdateFluidDisplayItem(this::updateFluidInputDisplayItem)
+ .setGTTooltip(
+ () -> mTooltipCache
+ .getData(FLUID_INPUT_TOOLTIP, GT_Utility.formatNumbers(getCapacity())))
+ .setTooltipShowUpDelay(TOOLTIP_DELAY).setBackground(backgrounds).setPos(pos);
}
protected FluidDisplaySlotWidget createFluidOutputSlot(IDrawable[] backgrounds, Pos2d pos) {
@@ -1448,9 +1377,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
.setUpdateFluidDisplayItem(this::updateFluidOutputDisplayItem)
.setGTTooltip(
() -> mTooltipCache.getData(FLUID_OUTPUT_TOOLTIP, GT_Utility.formatNumbers(getCapacity())))
- .setTooltipShowUpDelay(TOOLTIP_DELAY)
- .setBackground(backgrounds)
- .setPos(pos);
+ .setTooltipShowUpDelay(TOOLTIP_DELAY).setBackground(backgrounds).setPos(pos);
}
@Override
@@ -1464,35 +1391,26 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
}
protected CycleButtonWidget createItemAutoOutputButton() {
- return (CycleButtonWidget) new CycleButtonWidget()
- .setToggle(() -> mItemTransfer, val -> mItemTransfer = val)
+ return (CycleButtonWidget) new CycleButtonWidget().setToggle(() -> mItemTransfer, val -> mItemTransfer = val)
.setStaticTexture(GT_UITextures.OVERLAY_BUTTON_AUTOOUTPUT_ITEM)
.setVariableBackground(GT_UITextures.BUTTON_STANDARD_TOGGLE)
- .setGTTooltip(() -> mTooltipCache.getData(ITEM_TRANSFER_TOOLTIP))
- .setTooltipShowUpDelay(TOOLTIP_DELAY)
- .setPos(25, 62)
- .setSize(18, 18);
+ .setGTTooltip(() -> mTooltipCache.getData(ITEM_TRANSFER_TOOLTIP)).setTooltipShowUpDelay(TOOLTIP_DELAY)
+ .setPos(25, 62).setSize(18, 18);
}
protected CycleButtonWidget createFluidAutoOutputButton() {
- return (CycleButtonWidget) new CycleButtonWidget()
- .setToggle(() -> mFluidTransfer, val -> mFluidTransfer = val)
+ return (CycleButtonWidget) new CycleButtonWidget().setToggle(() -> mFluidTransfer, val -> mFluidTransfer = val)
.setStaticTexture(GT_UITextures.OVERLAY_BUTTON_AUTOOUTPUT_FLUID)
.setVariableBackground(GT_UITextures.BUTTON_STANDARD_TOGGLE)
- .setGTTooltip(() -> mTooltipCache.getData(FLUID_TRANSFER_TOOLTIP))
- .setTooltipShowUpDelay(TOOLTIP_DELAY)
- .setPos(7, 62)
- .setSize(18, 18);
+ .setGTTooltip(() -> mTooltipCache.getData(FLUID_TRANSFER_TOOLTIP)).setTooltipShowUpDelay(TOOLTIP_DELAY)
+ .setPos(7, 62).setSize(18, 18);
}
- protected ProgressBar createProgressBar(
- UITexture texture, int imageSize, ProgressBar.Direction direction, Pos2d pos, Size size) {
+ protected ProgressBar createProgressBar(UITexture texture, int imageSize, ProgressBar.Direction direction,
+ Pos2d pos, Size size) {
final ProgressBar ret = new ProgressBar();
ret.setProgress(() -> maxProgresstime() != 0 ? (float) getProgresstime() / maxProgresstime() : 0)
- .setTexture(texture, imageSize)
- .setDirection(direction)
- .setPos(pos)
- .setSize(size);
+ .setTexture(texture, imageSize).setDirection(direction).setPos(pos).setSize(size);
return ret;
}
@@ -1505,13 +1423,13 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
final Power powerInfo = getPower();
final String transferRectTooltip;
if (isSteampowered()) {
- transferRectTooltip =
- StatCollector.translateToLocalFormatted(NEI_TRANSFER_STEAM_TOOLTIP, powerInfo.getTierString());
+ transferRectTooltip = StatCollector
+ .translateToLocalFormatted(NEI_TRANSFER_STEAM_TOOLTIP, powerInfo.getTierString());
} else {
- transferRectTooltip = StatCollector.translateToLocalFormatted(
- NEI_TRANSFER_VOLTAGE_TOOLTIP, powerInfo.getTierString());
+ transferRectTooltip = StatCollector
+ .translateToLocalFormatted(NEI_TRANSFER_VOLTAGE_TOOLTIP, powerInfo.getTierString());
}
- widget.setNEITransferRect(transferRectID, new Object[] {powerInfo}, transferRectTooltip);
+ widget.setNEITransferRect(transferRectID, new Object[] { powerInfo }, transferRectTooltip);
}
return widget;
}
@@ -1519,30 +1437,25 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
protected void addProgressBarSpecialTextures(ModularWindow.Builder builder) {
if (isSteampowered()) {
for (Pair<SteamTexture, Pair<Size, Pos2d>> specialTexture : getRecipeList().specialTexturesSteam) {
- builder.widget(new DrawableWidget()
- .setDrawable(specialTexture.getLeft().get(getSteamVariant()))
- .setSize(specialTexture.getRight().getLeft())
- .setPos(specialTexture.getRight().getRight()));
+ builder.widget(
+ new DrawableWidget().setDrawable(specialTexture.getLeft().get(getSteamVariant()))
+ .setSize(specialTexture.getRight().getLeft())
+ .setPos(specialTexture.getRight().getRight()));
}
} else {
for (Pair<IDrawable, Pair<Size, Pos2d>> specialTexture : getRecipeList().specialTextures) {
- builder.widget(new DrawableWidget()
- .setDrawable(specialTexture.getLeft())
- .setSize(specialTexture.getRight().getLeft())
- .setPos(specialTexture.getRight().getRight()));
+ builder.widget(
+ new DrawableWidget().setDrawable(specialTexture.getLeft())
+ .setSize(specialTexture.getRight().getLeft())
+ .setPos(specialTexture.getRight().getRight()));
}
}
}
protected DrawableWidget createErrorStatusArea(ModularWindow.Builder builder, IDrawable picture) {
- return (DrawableWidget) new DrawableWidget()
- .setDrawable(picture)
- .setTooltipShowUpDelay(TOOLTIP_DELAY)
- .setEnabled(widget -> !widget.getTooltip().isEmpty())
- .dynamicTooltip(this::getErrorDescriptions)
- .dynamicTooltipShift(this::getErrorDescriptionsShift)
- .setPos(79, 44)
- .setSize(18, 18)
+ return (DrawableWidget) new DrawableWidget().setDrawable(picture).setTooltipShowUpDelay(TOOLTIP_DELAY)
+ .setEnabled(widget -> !widget.getTooltip().isEmpty()).dynamicTooltip(this::getErrorDescriptions)
+ .dynamicTooltipShift(this::getErrorDescriptionsShift).setPos(79, 44).setSize(18, 18)
.attachSyncer(
new FakeSyncWidget.BooleanSyncer(() -> mStuttering, val -> mStuttering = val),
builder,
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java
index 468566e582..9bccd8f093 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java
@@ -4,8 +4,16 @@ import static gregtech.api.enums.GT_Values.D1;
import static gregtech.api.enums.Textures.BlockIcons.*;
import static gregtech.api.objects.XSTR.XSTR_INSTANCE;
+import java.util.ArrayList;
+
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraftforge.common.util.ForgeDirection;
+
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.common.widget.DrawableWidget;
+
import gregtech.api.GregTech_API;
import gregtech.api.enums.Dyes;
import gregtech.api.enums.ParticleFX;
@@ -22,30 +30,20 @@ import gregtech.api.util.GT_Utility;
import gregtech.api.util.WorldSpawnedEventBuilder.ParticleEventBuilder;
import gregtech.common.power.Power;
import gregtech.common.power.SteamPower;
-import java.util.ArrayList;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraftforge.common.util.ForgeDirection;
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
* <p/>
- * This is the main construct for my Basic Machines such as the Automatic Extractor
- * Extend this class to make a simple Machine
+ * This is the main construct for my Basic Machines such as the Automatic Extractor Extend this class to make a simple
+ * Machine
*/
public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileEntity_BasicMachine {
+
private static final int NEEDS_STEAM_VENTING = 64;
public boolean mNeedsSteamVenting = false;
- public GT_MetaTileEntity_BasicMachine_Bronze(
- int aID,
- String aName,
- String aNameRegional,
- String aDescription,
- int aInputSlotCount,
- int aOutputSlotCount,
- boolean aHighPressure) {
+ public GT_MetaTileEntity_BasicMachine_Bronze(int aID, String aName, String aNameRegional, String aDescription,
+ int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) {
super(
aID,
aName,
@@ -59,23 +57,13 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE
"");
}
- public GT_MetaTileEntity_BasicMachine_Bronze(
- String aName,
- String aDescription,
- ITexture[][][] aTextures,
- int aInputSlotCount,
- int aOutputSlotCount,
- boolean aHighPressure) {
+ public GT_MetaTileEntity_BasicMachine_Bronze(String aName, String aDescription, ITexture[][][] aTextures,
+ int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) {
super(aName, aHighPressure ? 2 : 1, 0, aDescription, aTextures, aInputSlotCount, aOutputSlotCount, "", "");
}
- public GT_MetaTileEntity_BasicMachine_Bronze(
- String aName,
- String[] aDescription,
- ITexture[][][] aTextures,
- int aInputSlotCount,
- int aOutputSlotCount,
- boolean aHighPressure) {
+ public GT_MetaTileEntity_BasicMachine_Bronze(String aName, String[] aDescription, ITexture[][][] aTextures,
+ int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) {
super(aName, aHighPressure ? 2 : 1, 0, aDescription, aTextures, aInputSlotCount, aOutputSlotCount, "", "");
}
@@ -173,51 +161,27 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE
@Override
public boolean allowToCheckRecipe() {
if (mNeedsSteamVenting
- && getBaseMetaTileEntity()
- .getCoverIDAtSide(getBaseMetaTileEntity().getFrontFacing())
- == 0
+ && getBaseMetaTileEntity().getCoverIDAtSide(getBaseMetaTileEntity().getFrontFacing()) == 0
&& !GT_Utility.hasBlockHitBox(
getBaseMetaTileEntity().getWorld(),
- getBaseMetaTileEntity()
- .getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 1),
- getBaseMetaTileEntity()
- .getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 1),
- getBaseMetaTileEntity()
- .getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 1))) {
+ getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 1),
+ getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 1),
+ getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 1))) {
sendSound((byte) 9);
mNeedsSteamVenting = false;
try {
- for (EntityLivingBase tLiving : (ArrayList<EntityLivingBase>) getBaseMetaTileEntity()
- .getWorld()
+ for (EntityLivingBase tLiving : (ArrayList<EntityLivingBase>) getBaseMetaTileEntity().getWorld()
.getEntitiesWithinAABB(
EntityLivingBase.class,
AxisAlignedBB.getBoundingBox(
- getBaseMetaTileEntity()
- .getOffsetX(
- getBaseMetaTileEntity().getFrontFacing(), 1),
- getBaseMetaTileEntity()
- .getOffsetY(
- getBaseMetaTileEntity().getFrontFacing(), 1),
- getBaseMetaTileEntity()
- .getOffsetZ(
- getBaseMetaTileEntity().getFrontFacing(), 1),
- getBaseMetaTileEntity()
- .getOffsetX(
- getBaseMetaTileEntity()
- .getFrontFacing(),
- 1)
+ getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 1),
+ getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 1),
+ getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 1),
+ getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 1)
+ 1,
- getBaseMetaTileEntity()
- .getOffsetY(
- getBaseMetaTileEntity()
- .getFrontFacing(),
- 1)
+ getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 1)
+ 1,
- getBaseMetaTileEntity()
- .getOffsetZ(
- getBaseMetaTileEntity()
- .getFrontFacing(),
- 1)
+ getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 1)
+ 1))) {
GT_Utility.applyHeatDamage(tLiving, getSteamDamage());
}
@@ -230,11 +194,13 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE
@Override
public int checkRecipe() {
- GT_Recipe tRecipe = getRecipeList()
- .findRecipe(
- getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[mTier], null, getAllInputs());
- if ((tRecipe != null)
- && (canOutput(tRecipe.mOutputs))
+ GT_Recipe tRecipe = getRecipeList().findRecipe(
+ getBaseMetaTileEntity(),
+ false,
+ gregtech.api.enums.GT_Values.V[mTier],
+ null,
+ getAllInputs());
+ if ((tRecipe != null) && (canOutput(tRecipe.mOutputs))
&& (tRecipe.isRecipeInputEqual(true, null, getAllInputs()))) {
this.mOutputItems[0] = tRecipe.getOutput(0);
calculateOverclockedNess(tRecipe);
@@ -261,27 +227,17 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE
if (aIndex == 9) {
GT_Utility.doSoundAtClient(SoundResource.RANDOM_FIZZ, 5, 1.0F, aX, aY, aZ);
- new ParticleEventBuilder()
- .setIdentifier(ParticleFX.CLOUD)
- .setWorld(getBaseMetaTileEntity().getWorld())
+ new ParticleEventBuilder().setIdentifier(ParticleFX.CLOUD).setWorld(getBaseMetaTileEntity().getWorld())
.setMotion(
- ForgeDirection.getOrientation(
- getBaseMetaTileEntity().getFrontFacing())
- .offsetX
- / 5.0,
- ForgeDirection.getOrientation(
- getBaseMetaTileEntity().getFrontFacing())
- .offsetY
- / 5.0,
- ForgeDirection.getOrientation(
- getBaseMetaTileEntity().getFrontFacing())
- .offsetZ
- / 5.0)
- .<ParticleEventBuilder>times(8, x -> x.setPosition(
+ ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetX / 5.0,
+ ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetY / 5.0,
+ ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetZ / 5.0)
+ .<ParticleEventBuilder>times(
+ 8,
+ x -> x.setPosition(
aX - 0.5 + XSTR_INSTANCE.nextFloat(),
aY - 0.5 + XSTR_INSTANCE.nextFloat(),
- aZ - 0.5 + XSTR_INSTANCE.nextFloat())
- .run());
+ aZ - 0.5 + XSTR_INSTANCE.nextFloat()).run());
}
}
@@ -302,134 +258,100 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE
@Override
public ITexture[] getSideFacingActive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa))
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) };
}
@Override
public ITexture[] getSideFacingInactive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa))
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) };
}
@Override
public ITexture[] getFrontFacingActive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa))
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) };
}
@Override
public ITexture[] getFrontFacingInactive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa))
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) };
}
@Override
public ITexture[] getTopFacingActive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa))
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) };
}
@Override
public ITexture[] getTopFacingInactive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa))
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) };
}
@Override
public ITexture[] getBottomFacingActive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa))
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) };
}
@Override
public ITexture[] getBottomFacingInactive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa))
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) };
}
@Override
public ITexture[] getBottomFacingPipeActive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa)),
- TextureFactory.of(OVERLAY_PIPE_OUT)
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) };
}
@Override
public ITexture[] getBottomFacingPipeInactive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa)),
- TextureFactory.of(OVERLAY_PIPE_OUT)
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) };
}
@Override
public ITexture[] getTopFacingPipeActive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa)),
- TextureFactory.of(OVERLAY_PIPE_OUT)
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) };
}
@Override
public ITexture[] getTopFacingPipeInactive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa)),
- TextureFactory.of(OVERLAY_PIPE_OUT)
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) };
}
@Override
public ITexture[] getSideFacingPipeActive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa)),
- TextureFactory.of(OVERLAY_PIPE_OUT)
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) };
}
@Override
public ITexture[] getSideFacingPipeInactive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa)),
- TextureFactory.of(OVERLAY_PIPE_OUT)
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) };
}
@Override
@@ -444,9 +366,7 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE
@Override
public void addGregTechLogo(ModularWindow.Builder builder) {
- builder.widget(new DrawableWidget()
- .setDrawable(getGUITextureSet().getGregTechLogo())
- .setSize(17, 17)
- .setPos(152, 63));
+ builder.widget(
+ new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()).setSize(17, 17).setPos(152, 63));
}
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java
index 75b055324a..7976ea94c6 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java
@@ -6,11 +6,23 @@ import static gregtech.api.enums.GT_Values.W;
import static gregtech.api.enums.GT_Values.ticksBetweenSounds;
import static gregtech.api.objects.XSTR.XSTR_INSTANCE;
+import java.util.Locale;
+
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.ResourceLocation;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.oredict.OreDictionary;
+
import com.gtnewhorizons.modularui.api.drawable.FallbackableUITexture;
import com.gtnewhorizons.modularui.api.drawable.UITexture;
import com.gtnewhorizons.modularui.api.math.Pos2d;
import com.gtnewhorizons.modularui.api.math.Size;
import com.gtnewhorizons.modularui.common.widget.ProgressBar;
+
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -31,23 +43,15 @@ import gregtech.api.util.GT_Utility;
import gregtech.api.util.WorldSpawnedEventBuilder;
import gregtech.api.util.WorldSpawnedEventBuilder.ParticleEventBuilder;
import ic2.core.Ic2Items;
-import java.util.Locale;
-import net.minecraft.block.Block;
-import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraft.init.Blocks;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.ResourceLocation;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.oredict.OreDictionary;
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
* <p/>
- * This is the main construct for my Basic Machines such as the Automatic Extractor
- * Extend this class to make a simple Machine
+ * This is the main construct for my Basic Machines such as the Automatic Extractor Extend this class to make a simple
+ * Machine
*/
public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_BasicMachine {
+
private final GT_Recipe.GT_Recipe_Map mRecipes;
private final int mTankCapacity;
private final SpecialEffects mSpecialEffect;
@@ -56,25 +60,10 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
private final byte mGUIParameterA, mGUIParameterB;
private FallbackableUITexture progressBarTexture;
- public GT_MetaTileEntity_BasicMachine_GT_Recipe(
- int aID,
- String aName,
- String aNameRegional,
- int aTier,
- String aDescription,
- GT_Recipe.GT_Recipe_Map aRecipes,
- int aInputSlots,
- int aOutputSlots,
- int aTankCapacity,
- int aGUIParameterA,
- int aGUIParameterB,
- String aGUIName,
- ResourceLocation aSound,
- boolean aSharedTank,
- boolean aRequiresFluidForFiltering,
- SpecialEffects aSpecialEffect,
- String aOverlays,
- Object[] aRecipe) {
+ public GT_MetaTileEntity_BasicMachine_GT_Recipe(int aID, String aName, String aNameRegional, int aTier,
+ String aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity,
+ int aGUIParameterA, int aGUIParameterB, String aGUIName, ResourceLocation aSound, boolean aSharedTank,
+ boolean aRequiresFluidForFiltering, SpecialEffects aSpecialEffect, String aOverlays, Object[] aRecipe) {
super(
aID,
aName,
@@ -87,69 +76,89 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
aGUIName,
aRecipes.mNEIName,
TextureFactory.of(
- TextureFactory.of(new CustomIcon(
- "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE_ACTIVE")),
+ TextureFactory.of(
+ new CustomIcon(
+ "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH)
+ + "/OVERLAY_SIDE_ACTIVE")),
TextureFactory.builder()
- .addIcon((new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH)
- + "/OVERLAY_SIDE_ACTIVE_GLOW")))
- .glow()
- .build()),
+ .addIcon(
+ (new CustomIcon(
+ "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH)
+ + "/OVERLAY_SIDE_ACTIVE_GLOW")))
+ .glow().build()),
TextureFactory.of(
- TextureFactory.of(new CustomIcon(
- "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE")),
+ TextureFactory.of(
+ new CustomIcon(
+ "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE")),
TextureFactory.builder()
- .addIcon((new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH)
- + "/OVERLAY_SIDE_GLOW")))
- .glow()
- .build()),
+ .addIcon(
+ (new CustomIcon(
+ "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH)
+ + "/OVERLAY_SIDE_GLOW")))
+ .glow().build()),
TextureFactory.of(
- TextureFactory.of(new CustomIcon(
- "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT_ACTIVE")),
+ TextureFactory.of(
+ new CustomIcon(
+ "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH)
+ + "/OVERLAY_FRONT_ACTIVE")),
TextureFactory.builder()
- .addIcon((new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH)
- + "/OVERLAY_FRONT_ACTIVE_GLOW")))
- .glow()
- .build()),
+ .addIcon(
+ (new CustomIcon(
+ "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH)
+ + "/OVERLAY_FRONT_ACTIVE_GLOW")))
+ .glow().build()),
TextureFactory.of(
- TextureFactory.of(new CustomIcon(
- "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT")),
+ TextureFactory.of(
+ new CustomIcon(
+ "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT")),
TextureFactory.builder()
- .addIcon((new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH)
- + "/OVERLAY_FRONT_GLOW")))
- .glow()
- .build()),
+ .addIcon(
+ (new CustomIcon(
+ "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH)
+ + "/OVERLAY_FRONT_GLOW")))
+ .glow().build()),
TextureFactory.of(
- TextureFactory.of(new CustomIcon(
- "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP_ACTIVE")),
+ TextureFactory.of(
+ new CustomIcon(
+ "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH)
+ + "/OVERLAY_TOP_ACTIVE")),
TextureFactory.builder()
- .addIcon((new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH)
- + "/OVERLAY_TOP_ACTIVE_GLOW")))
- .glow()
- .build()),
+ .addIcon(
+ (new CustomIcon(
+ "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH)
+ + "/OVERLAY_TOP_ACTIVE_GLOW")))
+ .glow().build()),
TextureFactory.of(
- TextureFactory.of(new CustomIcon(
- "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP")),
+ TextureFactory.of(
+ new CustomIcon(
+ "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP")),
TextureFactory.builder()
- .addIcon((new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH)
- + "/OVERLAY_TOP_GLOW")))
- .glow()
- .build()),
+ .addIcon(
+ (new CustomIcon(
+ "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH)
+ + "/OVERLAY_TOP_GLOW")))
+ .glow().build()),
TextureFactory.of(
- TextureFactory.of(new CustomIcon(
- "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM_ACTIVE")),
+ TextureFactory.of(
+ new CustomIcon(
+ "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH)
+ + "/OVERLAY_BOTTOM_ACTIVE")),
TextureFactory.builder()
- .addIcon((new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH)
- + "/OVERLAY_BOTTOM_ACTIVE_GLOW")))
- .glow()
- .build()),
+ .addIcon(
+ (new CustomIcon(
+ "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH)
+ + "/OVERLAY_BOTTOM_ACTIVE_GLOW")))
+ .glow().build()),
TextureFactory.of(
- TextureFactory.of(new CustomIcon(
- "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM")),
+ TextureFactory.of(
+ new CustomIcon(
+ "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM")),
TextureFactory.builder()
- .addIcon((new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH)
- + "/OVERLAY_BOTTOM_GLOW")))
- .glow()
- .build()));
+ .addIcon(
+ (new CustomIcon(
+ "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH)
+ + "/OVERLAY_BOTTOM_GLOW")))
+ .glow().build()));
this.mSharedTank = aSharedTank;
this.mTankCapacity = aTankCapacity;
this.mSpecialEffect = aSpecialEffect;
@@ -891,36 +900,19 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
if (!GT_ModHandler.addCraftingRecipe(
getStackForm(1),
- GT_ModHandler.RecipeBits.DISMANTLEABLE
- | GT_ModHandler.RecipeBits.BUFFERED
+ GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.BUFFERED
| GT_ModHandler.RecipeBits.NOT_REMOVABLE
| GT_ModHandler.RecipeBits.REVERSIBLE,
aRecipe)) {
- throw new IllegalArgumentException(
- "INVALID CRAFTING RECIPE FOR: " + getStackForm(1).getDisplayName());
+ throw new IllegalArgumentException("INVALID CRAFTING RECIPE FOR: " + getStackForm(1).getDisplayName());
}
}
}
- public GT_MetaTileEntity_BasicMachine_GT_Recipe(
- int aID,
- String aName,
- String aNameRegional,
- int aTier,
- String aDescription,
- GT_Recipe.GT_Recipe_Map aRecipes,
- int aInputSlots,
- int aOutputSlots,
- int aTankCapacity,
- int aGUIParameterA,
- int aGUIParameterB,
- String aGUIName,
- SoundResource aSound,
- boolean aSharedTank,
- boolean aRequiresFluidForFiltering,
- SpecialEffects aSpecialEffect,
- String aOverlays,
- Object[] aRecipe) {
+ public GT_MetaTileEntity_BasicMachine_GT_Recipe(int aID, String aName, String aNameRegional, int aTier,
+ String aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity,
+ int aGUIParameterA, int aGUIParameterB, String aGUIName, SoundResource aSound, boolean aSharedTank,
+ boolean aRequiresFluidForFiltering, SpecialEffects aSpecialEffect, String aOverlays, Object[] aRecipe) {
this(
aID,
aName,
@@ -944,31 +936,15 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
/**
* @inheritDoc
- * @deprecated Use {@link #GT_MetaTileEntity_BasicMachine_GT_Recipe(
- * int aID, String, String, int, String, GT_Recipe.GT_Recipe_Map,
- * int, int, int, int, int, String, ResourceLocation, boolean,
- * boolean, SpecialEffects, String , Object[])}
+ * @deprecated Use {@link #GT_MetaTileEntity_BasicMachine_GT_Recipe( int aID, String, String, int, String,
+ * GT_Recipe.GT_Recipe_Map, int, int, int, int, int, String, ResourceLocation, boolean, boolean,
+ * SpecialEffects, String , Object[])}
*/
@Deprecated
- public GT_MetaTileEntity_BasicMachine_GT_Recipe(
- int aID,
- String aName,
- String aNameRegional,
- int aTier,
- String aDescription,
- GT_Recipe.GT_Recipe_Map aRecipes,
- int aInputSlots,
- int aOutputSlots,
- int aTankCapacity,
- int aGUIParameterA,
- int aGUIParameterB,
- String aGUIName,
- String aSound,
- boolean aSharedTank,
- boolean aRequiresFluidForFiltering,
- int aSpecialEffect,
- String aOverlays,
- Object[] aRecipe) {
+ public GT_MetaTileEntity_BasicMachine_GT_Recipe(int aID, String aName, String aNameRegional, int aTier,
+ String aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity,
+ int aGUIParameterA, int aGUIParameterB, String aGUIName, String aSound, boolean aSharedTank,
+ boolean aRequiresFluidForFiltering, int aSpecialEffect, String aOverlays, Object[] aRecipe) {
this(
aID,
aName,
@@ -990,24 +966,10 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
aRecipe);
}
- public GT_MetaTileEntity_BasicMachine_GT_Recipe(
- String aName,
- int aTier,
- String aDescription,
- GT_Recipe.GT_Recipe_Map aRecipes,
- int aInputSlots,
- int aOutputSlots,
- int aTankCapacity,
- int aAmperage,
- int aGUIParameterA,
- int aGUIParameterB,
- ITexture[][][] aTextures,
- String aGUIName,
- String aNEIName,
- String aSound,
- boolean aSharedTank,
- boolean aRequiresFluidForFiltering,
- int aSpecialEffect) {
+ public GT_MetaTileEntity_BasicMachine_GT_Recipe(String aName, int aTier, String aDescription,
+ GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aAmperage,
+ int aGUIParameterA, int aGUIParameterB, ITexture[][][] aTextures, String aGUIName, String aNEIName,
+ String aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, int aSpecialEffect) {
super(aName, aTier, aAmperage, aDescription, aTextures, aInputSlots, aOutputSlots, aGUIName, aNEIName);
this.mSharedTank = aSharedTank;
this.mTankCapacity = aTankCapacity;
@@ -1019,24 +981,10 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
this.mGUIParameterB = (byte) aGUIParameterB;
}
- public GT_MetaTileEntity_BasicMachine_GT_Recipe(
- String aName,
- int aTier,
- String[] aDescription,
- GT_Recipe.GT_Recipe_Map aRecipes,
- int aInputSlots,
- int aOutputSlots,
- int aTankCapacity,
- int aAmperage,
- int aGUIParameterA,
- int aGUIParameterB,
- ITexture[][][] aTextures,
- String aGUIName,
- String aNEIName,
- String aSound,
- boolean aSharedTank,
- boolean aRequiresFluidForFiltering,
- int aSpecialEffect) {
+ public GT_MetaTileEntity_BasicMachine_GT_Recipe(String aName, int aTier, String[] aDescription,
+ GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aAmperage,
+ int aGUIParameterA, int aGUIParameterB, ITexture[][][] aTextures, String aGUIName, String aNEIName,
+ String aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, int aSpecialEffect) {
super(aName, aTier, aAmperage, aDescription, aTextures, aInputSlots, aOutputSlots, aGUIName, aNEIName);
this.mSharedTank = aSharedTank;
this.mTankCapacity = aTankCapacity;
@@ -1051,24 +999,23 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
@Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MetaTileEntity_BasicMachine_GT_Recipe(
- this.mName,
- this.mTier,
- this.mDescriptionArray,
- this.mRecipes,
- this.mInputSlotCount,
- this.mOutputItems == null ? 0 : this.mOutputItems.length,
- this.mTankCapacity,
- this.mAmperage,
- this.mGUIParameterA,
- this.mGUIParameterB,
- this.mTextures,
- this.mGUIName,
- this.mNEIName,
- this.mSoundResourceLocation.toString(),
- this.mSharedTank,
- this.mRequiresFluidForFiltering,
- this.mSpecialEffect.ordinal())
- .setProgressBarTexture(this.progressBarTexture);
+ this.mName,
+ this.mTier,
+ this.mDescriptionArray,
+ this.mRecipes,
+ this.mInputSlotCount,
+ this.mOutputItems == null ? 0 : this.mOutputItems.length,
+ this.mTankCapacity,
+ this.mAmperage,
+ this.mGUIParameterA,
+ this.mGUIParameterB,
+ this.mTextures,
+ this.mGUIName,
+ this.mNEIName,
+ this.mSoundResourceLocation.toString(),
+ this.mSharedTank,
+ this.mRequiresFluidForFiltering,
+ this.mSpecialEffect.ordinal()).setProgressBarTexture(this.progressBarTexture);
}
public GT_MetaTileEntity_BasicMachine_GT_Recipe setProgressBarTexture(FallbackableUITexture progressBarTexture) {
@@ -1097,67 +1044,61 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
aBaseMetaTileEntity,
this.getLocalName(),
this.mGUIName,
- GT_Utility.isStringValid(this.mNEIName)
- ? this.mNEIName
+ GT_Utility.isStringValid(this.mNEIName) ? this.mNEIName
: this.getRecipeList() != null ? this.getRecipeList().mUnlocalizedName : "",
this.mGUIParameterA,
this.mGUIParameterB);
}
@Override
- protected boolean allowPutStackValidated(
- IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide,
+ ItemStack aStack) {
if (!super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack)) return false;
switch (this.mInputSlotCount) {
case 0:
return false;
case 1:
if (this.getFillableStack() == null)
- return !this.mRequiresFluidForFiltering
- && this.getRecipeList().containsInput(aStack);
- else
- return this.getRecipeList()
- .findRecipe(
- this.getBaseMetaTileEntity(),
- this.mLastRecipe,
- true,
- true,
- V[this.mTier],
- new FluidStack[] {this.getFillableStack()},
- this.getSpecialSlot(),
- appendSelectedCircuit(aStack))
- != null;
+ return !this.mRequiresFluidForFiltering && this.getRecipeList().containsInput(aStack);
+ else return this.getRecipeList().findRecipe(
+ this.getBaseMetaTileEntity(),
+ this.mLastRecipe,
+ true,
+ true,
+ V[this.mTier],
+ new FluidStack[] { this.getFillableStack() },
+ this.getSpecialSlot(),
+ appendSelectedCircuit(aStack)) != null;
case 2:
- return (!this.mRequiresFluidForFiltering || this.getFillableStack() != null)
- && (((this.getInputAt(0) != null && this.getInputAt(1) != null)
- || (this.getInputAt(0) == null && this.getInputAt(1) == null
- ? this.getRecipeList().containsInput(aStack)
- : (this.getRecipeList().containsInput(aStack)
- && this.getRecipeList()
- .findRecipe(
- this.getBaseMetaTileEntity(),
- this.mLastRecipe,
- true,
- true,
- V[this.mTier],
- new FluidStack[] {this.getFillableStack()},
- this.getSpecialSlot(),
- aIndex == this.getInputSlot()
- ? appendSelectedCircuit(
- aStack, this.getInputAt(1))
- : appendSelectedCircuit(
- this.getInputAt(0), aStack))
- != null))));
+ return (!this.mRequiresFluidForFiltering || this.getFillableStack() != null) && (((this.getInputAt(0)
+ != null && this.getInputAt(1) != null)
+ || (this.getInputAt(0) == null && this.getInputAt(1) == null
+ ? this.getRecipeList().containsInput(aStack)
+ : (this.getRecipeList().containsInput(aStack) && this.getRecipeList().findRecipe(
+ this.getBaseMetaTileEntity(),
+ this.mLastRecipe,
+ true,
+ true,
+ V[this.mTier],
+ new FluidStack[] { this.getFillableStack() },
+ this.getSpecialSlot(),
+ aIndex == this.getInputSlot()
+ ? appendSelectedCircuit(aStack, this.getInputAt(1))
+ : appendSelectedCircuit(this.getInputAt(0), aStack))
+ != null))));
default: {
int tID = this.getBaseMetaTileEntity().getMetaTileID();
- if (tID >= 211 && tID <= 218
- || tID >= 1180 && tID <= 1187
- || tID >= 10780
- && tID <= 10786) { // assembler lv-iv; circuit asseblers lv - uv; assemblers luv-uev
- if (GT_Utility.isStackValid(aStack))
- for (int oreID : OreDictionary.getOreIDs(aStack)) {
- if (OreDictionary.getOreName(oreID).startsWith("circuit")) return true;
- }
+ if (tID >= 211 && tID <= 218 || tID >= 1180 && tID <= 1187 || tID >= 10780 && tID <= 10786) { // assembler
+ // lv-iv;
+ // circuit
+ // asseblers
+ // lv -
+ // uv;
+ // assemblers
+ // luv-uev
+ if (GT_Utility.isStackValid(aStack)) for (int oreID : OreDictionary.getOreIDs(aStack)) {
+ if (OreDictionary.getOreName(oreID).startsWith("circuit")) return true;
+ }
}
return this.getRecipeList().containsInput(aStack);
}
@@ -1173,7 +1114,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
super.onPreTick(aBaseMetaTileEntity, aTick);
if (aBaseMetaTileEntity.isClientSide() && aBaseMetaTileEntity.isActive()) {
- //noinspection SwitchStatementWithTooFewBranches
+ // noinspection SwitchStatementWithTooFewBranches
switch (this.mSpecialEffect) {
case TOP_SMOKE:
final byte topFacing = (byte) ForgeDirection.UP.ordinal();
@@ -1182,15 +1123,13 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
&& aBaseMetaTileEntity.getCoverIDAtSide(topFacing) == 0
&& !aBaseMetaTileEntity.getOpacityAtSide(topFacing)) {
- new WorldSpawnedEventBuilder.ParticleEventBuilder()
- .setMotion(0.0D, 0.0D, 0.0D)
+ new WorldSpawnedEventBuilder.ParticleEventBuilder().setMotion(0.0D, 0.0D, 0.0D)
.setIdentifier(ParticleFX.SMOKE)
.setPosition(
aBaseMetaTileEntity.getXCoord() + 0.8F - XSTR_INSTANCE.nextFloat() * 0.6F,
aBaseMetaTileEntity.getYCoord() + 0.9F + XSTR_INSTANCE.nextFloat() * 0.2F,
aBaseMetaTileEntity.getZCoord() + 0.8F - XSTR_INSTANCE.nextFloat() * 0.6F)
- .setWorld(aBaseMetaTileEntity.getWorld())
- .run();
+ .setWorld(aBaseMetaTileEntity.getWorld()).run();
}
break;
default:
@@ -1208,7 +1147,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
@Override
public void onRandomDisplayTick(IGregTechTileEntity aBaseMetaTileEntity) {
- //noinspection SwitchStatementWithTooFewBranches
+ // noinspection SwitchStatementWithTooFewBranches
switch (this.mSpecialEffect) {
case MAIN_RANDOM_SPARKS:
// Random Sparkles at main face
@@ -1216,8 +1155,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
final byte mainFacing = (byte) this.mMainFacing;
- if (mainFacing > 1
- && aBaseMetaTileEntity.getCoverIDAtSide(mainFacing) == 0
+ if (mainFacing > 1 && aBaseMetaTileEntity.getCoverIDAtSide(mainFacing) == 0
&& !aBaseMetaTileEntity.getOpacityAtSide(mainFacing)) {
final double oX = aBaseMetaTileEntity.getXCoord();
@@ -1253,10 +1191,8 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
mZ = .05D;
}
- ParticleEventBuilder particleEventBuilder = (new ParticleEventBuilder())
- .setMotion(mX, 0, mZ)
- .setPosition(x, y, z)
- .setWorld(getBaseMetaTileEntity().getWorld());
+ ParticleEventBuilder particleEventBuilder = (new ParticleEventBuilder()).setMotion(mX, 0, mZ)
+ .setPosition(x, y, z).setWorld(getBaseMetaTileEntity().getWorld());
particleEventBuilder.setIdentifier(ParticleFX.LAVA).run();
}
}
@@ -1279,8 +1215,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
@Override
public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
super.startSoundLoop(aIndex, aX, aY, aZ);
- if (aIndex == 1
- && this.mSoundResourceLocation != null
+ if (aIndex == 1 && this.mSoundResourceLocation != null
&& GT_Utility.isStringValid(this.mSoundResourceLocation.getResourceDomain())
&& GT_Utility.isStringValid(this.mSoundResourceLocation.getResourcePath()))
GT_Utility.doSoundAtClient(this.mSoundResourceLocation, 100, 1.0F, aX, aY, aZ);
@@ -1316,8 +1251,8 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
}
@Override
- protected ProgressBar createProgressBar(
- UITexture texture, int imageSize, ProgressBar.Direction direction, Pos2d pos, Size size) {
+ protected ProgressBar createProgressBar(UITexture texture, int imageSize, ProgressBar.Direction direction,
+ Pos2d pos, Size size) {
return super.createProgressBar(texture, imageSize, direction, pos, size)
.setTexture(progressBarTexture.get(), mRecipes.getProgressBarImageSize());
}
@@ -1352,11 +1287,12 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
* Special Effects
*/
public enum SpecialEffects {
+
NONE,
TOP_SMOKE,
MAIN_RANDOM_SPARKS;
- static final SpecialEffects[] VALID_SPECIAL_EFFECTS = {NONE, TOP_SMOKE, MAIN_RANDOM_SPARKS};
+ static final SpecialEffects[] VALID_SPECIAL_EFFECTS = { NONE, TOP_SMOKE, MAIN_RANDOM_SPARKS };
static SpecialEffects fromId(int id) {
return id >= 0 && id < VALID_SPECIAL_EFFECTS.length ? VALID_SPECIAL_EFFECTS[id] : NONE;
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Steel.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Steel.java
index 592d27f74f..3488ab25c1 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Steel.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Steel.java
@@ -19,39 +19,24 @@ import gregtech.common.power.SteamPower;
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
* <p/>
- * This is the main construct for my Basic Machines such as the Automatic Extractor
- * Extend this class to make a simple Machine
+ * This is the main construct for my Basic Machines such as the Automatic Extractor Extend this class to make a simple
+ * Machine
*/
public abstract class GT_MetaTileEntity_BasicMachine_Steel extends GT_MetaTileEntity_BasicMachine_Bronze
implements IGetTitleColor {
- public GT_MetaTileEntity_BasicMachine_Steel(
- int aID,
- String aName,
- String aNameRegional,
- String aDescription,
- int aInputSlotCount,
- int aOutputSlotCount,
- boolean aHighPressure) {
+
+ public GT_MetaTileEntity_BasicMachine_Steel(int aID, String aName, String aNameRegional, String aDescription,
+ int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) {
super(aID, aName, aNameRegional, aDescription, aInputSlotCount, aOutputSlotCount, aHighPressure);
}
- public GT_MetaTileEntity_BasicMachine_Steel(
- String aName,
- String aDescription,
- ITexture[][][] aTextures,
- int aInputSlotCount,
- int aOutputSlotCount,
- boolean aHighPressure) {
+ public GT_MetaTileEntity_BasicMachine_Steel(String aName, String aDescription, ITexture[][][] aTextures,
+ int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) {
super(aName, aDescription, aTextures, aInputSlotCount, aOutputSlotCount, aHighPressure);
}
- public GT_MetaTileEntity_BasicMachine_Steel(
- String aName,
- String[] aDescription,
- ITexture[][][] aTextures,
- int aInputSlotCount,
- int aOutputSlotCount,
- boolean aHighPressure) {
+ public GT_MetaTileEntity_BasicMachine_Steel(String aName, String[] aDescription, ITexture[][][] aTextures,
+ int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) {
super(aName, aDescription, aTextures, aInputSlotCount, aOutputSlotCount, aHighPressure);
}
@@ -62,134 +47,100 @@ public abstract class GT_MetaTileEntity_BasicMachine_Steel extends GT_MetaTileEn
@Override
public ITexture[] getSideFacingActive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa))
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) };
}
@Override
public ITexture[] getSideFacingInactive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa))
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) };
}
@Override
public ITexture[] getFrontFacingActive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa))
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) };
}
@Override
public ITexture[] getFrontFacingInactive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa))
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) };
}
@Override
public ITexture[] getTopFacingActive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa))
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) };
}
@Override
public ITexture[] getTopFacingInactive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa))
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) };
}
@Override
public ITexture[] getBottomFacingActive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa))
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) };
}
@Override
public ITexture[] getBottomFacingInactive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa))
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) };
}
@Override
public ITexture[] getBottomFacingPipeActive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa)),
- TextureFactory.of(OVERLAY_PIPE_OUT)
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) };
}
@Override
public ITexture[] getBottomFacingPipeInactive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa)),
- TextureFactory.of(OVERLAY_PIPE_OUT)
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) };
}
@Override
public ITexture[] getTopFacingPipeActive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa)),
- TextureFactory.of(OVERLAY_PIPE_OUT)
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) };
}
@Override
public ITexture[] getTopFacingPipeInactive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa)),
- TextureFactory.of(OVERLAY_PIPE_OUT)
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) };
}
@Override
public ITexture[] getSideFacingPipeActive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa)),
- TextureFactory.of(OVERLAY_PIPE_OUT)
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) };
}
@Override
public ITexture[] getSideFacingPipeInactive(byte aColor) {
- return new ITexture[] {
- TextureFactory.of(
- isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE,
- Dyes.getModulation(aColor, Dyes._NULL.mRGBa)),
- TextureFactory.of(OVERLAY_PIPE_OUT)
- };
+ return new ITexture[] { TextureFactory.of(
+ isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE,
+ Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) };
}
@Override
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java
index 0207178559..1286c84c9b 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java
@@ -1,11 +1,19 @@
package gregtech.api.metatileentity.implementations;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
import com.gtnewhorizons.modularui.common.internal.network.NetworkUtils;
import com.gtnewhorizons.modularui.common.widget.DrawableWidget;
import com.gtnewhorizons.modularui.common.widget.SlotWidget;
import com.gtnewhorizons.modularui.common.widget.TextWidget;
+
import gregtech.api.enums.ItemList;
import gregtech.api.gui.GT_Container_BasicTank;
import gregtech.api.gui.GT_GUIContainer_BasicTank;
@@ -17,12 +25,6 @@ import gregtech.api.interfaces.modularui.IAddUIWidgets;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.util.GT_Utility;
import gregtech.common.gui.modularui.widget.FluidDisplaySlotWidget;
-import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.fluids.FluidTankInfo;
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
@@ -38,35 +40,23 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier
/**
* @param aInvSlotCount should be 3
*/
- public GT_MetaTileEntity_BasicTank(
- int aID,
- String aName,
- String aNameRegional,
- int aTier,
- int aInvSlotCount,
- String aDescription,
- ITexture... aTextures) {
+ public GT_MetaTileEntity_BasicTank(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount,
+ String aDescription, ITexture... aTextures) {
super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures);
}
- public GT_MetaTileEntity_BasicTank(
- int aID,
- String aName,
- String aNameRegional,
- int aTier,
- int aInvSlotCount,
- String[] aDescription,
- ITexture... aTextures) {
+ public GT_MetaTileEntity_BasicTank(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount,
+ String[] aDescription, ITexture... aTextures) {
super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures);
}
- public GT_MetaTileEntity_BasicTank(
- String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_BasicTank(String aName, int aTier, int aInvSlotCount, String aDescription,
+ ITexture[][][] aTextures) {
super(aName, aTier, aInvSlotCount, aDescription, aTextures);
}
- public GT_MetaTileEntity_BasicTank(
- String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_BasicTank(String aName, int aTier, int aInvSlotCount, String[] aDescription,
+ ITexture[][][] aTextures) {
super(aName, aTier, aInvSlotCount, aDescription, aTextures);
}
@@ -135,7 +125,8 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier
}
/**
- * If you override this and change the field returned, be sure to override {@link #isDrainableStackSeparate()} as well!
+ * If you override this and change the field returned, be sure to override {@link #isDrainableStackSeparate()} as
+ * well!
*/
public FluidStack getDrainableStack() {
return mFluid;
@@ -217,8 +208,8 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier
}
if (doesFillContainers()) {
- ItemStack tOutput =
- GT_Utility.fillFluidContainer(getDrainableStack(), mInventory[getInputSlot()], false, true);
+ ItemStack tOutput = GT_Utility
+ .fillFluidContainer(getDrainableStack(), mInventory[getInputSlot()], false, true);
if (tOutput != null && aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), tOutput, 1)) {
FluidStack tFluid = GT_Utility.getFluidForFilledItem(tOutput, true);
aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1);
@@ -236,8 +227,8 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier
if (ItemList.Display_Fluid.isStackEqual(mInventory[getStackDisplaySlot()], true, true))
mInventory[getStackDisplaySlot()] = null;
} else {
- mInventory[getStackDisplaySlot()] =
- GT_Utility.getFluidDisplayStack(getDisplayedFluid(), true, !displaysStackSize());
+ mInventory[getStackDisplaySlot()] = GT_Utility
+ .getFluidDisplayStack(getDisplayedFluid(), true, !displaysStackSize());
}
}
}
@@ -254,11 +245,11 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier
@Override
public int fill(FluidStack aFluid, boolean doFill) {
- if (aFluid == null
- || aFluid.getFluid().getID() <= 0
+ if (aFluid == null || aFluid.getFluid().getID() <= 0
|| aFluid.amount <= 0
|| !canTankBeFilled()
- || !isFluidInputAllowed(aFluid)) return 0;
+ || !isFluidInputAllowed(aFluid))
+ return 0;
if (getFillableStack() == null || getFillableStack().getFluid().getID() <= 0) {
if (aFluid.amount <= getCapacity()) {
@@ -322,12 +313,10 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier
public FluidTankInfo[] getTankInfo(ForgeDirection aSide) {
if (getCapacity() <= 0 && !getBaseMetaTileEntity().hasSteamEngineUpgrade()) return new FluidTankInfo[] {};
if (isDrainableStackSeparate()) {
- return new FluidTankInfo[] {
- new FluidTankInfo(getFillableStack(), getCapacity()),
- new FluidTankInfo(getDrainableStack(), getCapacity())
- };
+ return new FluidTankInfo[] { new FluidTankInfo(getFillableStack(), getCapacity()),
+ new FluidTankInfo(getDrainableStack(), getCapacity()) };
} else {
- return new FluidTankInfo[] {new FluidTankInfo(this)};
+ return new FluidTankInfo[] { new FluidTankInfo(this) };
}
}
@@ -347,44 +336,32 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier
@Override
public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) {
- builder.widget(new DrawableWidget()
- .setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK)
- .setPos(7, 16)
- .setSize(71, 45))
- .widget(new DrawableWidget()
- .setDrawable(GT_UITextures.PICTURE_GAUGE)
- .setPos(79, 34)
- .setSize(18, 18))
- .widget(new SlotWidget(inventoryHandler, getInputSlot())
- .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_IN)
- .setPos(79, 16))
- .widget(new SlotWidget(inventoryHandler, getOutputSlot())
- .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_OUT)
- .setPos(79, 52))
- .widget(createDrainableFluidSlot()
- .setBackground(GT_UITextures.TRANSPARENT)
- .setPos(58, 41))
- .widget(new TextWidget("Liquid Amount")
- .setDefaultColor(COLOR_TEXT_WHITE.get())
- .setPos(10, 20))
- .widget(TextWidget.dynamicString(
- () -> GT_Utility.parseNumberToString(mFluid != null ? mFluid.amount : 0))
- .setDefaultColor(COLOR_TEXT_WHITE.get())
- .setPos(10, 30));
+ builder.widget(
+ new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK).setPos(7, 16).setSize(71, 45))
+ .widget(new DrawableWidget().setDrawable(GT_UITextures.PICTURE_GAUGE).setPos(79, 34).setSize(18, 18))
+ .widget(
+ new SlotWidget(inventoryHandler, getInputSlot())
+ .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_IN)
+ .setPos(79, 16))
+ .widget(
+ new SlotWidget(inventoryHandler, getOutputSlot())
+ .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_OUT)
+ .setPos(79, 52))
+ .widget(createDrainableFluidSlot().setBackground(GT_UITextures.TRANSPARENT).setPos(58, 41))
+ .widget(new TextWidget("Liquid Amount").setDefaultColor(COLOR_TEXT_WHITE.get()).setPos(10, 20)).widget(
+ TextWidget
+ .dynamicString(() -> GT_Utility.parseNumberToString(mFluid != null ? mFluid.amount : 0))
+ .setDefaultColor(COLOR_TEXT_WHITE.get()).setPos(10, 30));
}
protected FluidDisplaySlotWidget createDrainableFluidSlot() {
return new FluidDisplaySlotWidget(inventoryHandler, getStackDisplaySlot())
- .setFluidAccessConstructor(() -> constructFluidAccess(false))
- .setIHasFluidDisplay(this)
- .setCanDrain(true)
- .setCanFill(!isDrainableStackSeparate())
- .setActionRealClick(FluidDisplaySlotWidget.Action.TRANSFER)
- .setBeforeRealClick((clickData, widget) -> {
+ .setFluidAccessConstructor(() -> constructFluidAccess(false)).setIHasFluidDisplay(this)
+ .setCanDrain(true).setCanFill(!isDrainableStackSeparate())
+ .setActionRealClick(FluidDisplaySlotWidget.Action.TRANSFER).setBeforeRealClick((clickData, widget) -> {
if (NetworkUtils.isClient()) {
// propagate display item content to actual fluid stored in this tank
- setDrainableStack(GT_Utility.getFluidFromDisplayStack(
- widget.getMcSlot().getStack()));
+ setDrainableStack(GT_Utility.getFluidFromDisplayStack(widget.getMcSlot().getStack()));
}
return true;
});
@@ -395,6 +372,7 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier
}
protected static class BasicTankFluidAccess implements IFluidAccess {
+
protected final GT_MetaTileEntity_BasicTank mTank;
protected final boolean mIsFillableStack;
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java
index 6d327646fe..827f2b2ec9 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java
@@ -3,22 +3,26 @@ package gregtech.api.metatileentity.implementations;
import static gregtech.api.enums.GT_Values.V;
import static gregtech.api.enums.Textures.BlockIcons.*;
+import java.util.*;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.common.util.ForgeDirection;
+
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.common.widget.ButtonWidget;
import com.gtnewhorizons.modularui.common.widget.SlotGroup;
+
import gregtech.api.gui.modularui.GT_UIInfos;
import gregtech.api.gui.modularui.GT_UITextures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Utility;
-import java.util.*;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraftforge.common.util.ForgeDirection;
public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredMachineBlock {
+
private static final int OUTPUT_INDEX = 0;
private static final int ARROW_RIGHT_INDEX = 1;
private static final int ARROW_DOWN_INDEX = 2;
@@ -28,30 +32,27 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM
public int mMaxStackSize = 64;
public static int MAX = 8;
- public boolean bOutput = false,
- bRedstoneIfFull = false,
- bInvert = false,
- bStockingMode = false,
+ public boolean bOutput = false, bRedstoneIfFull = false, bInvert = false, bStockingMode = false,
bSortStacks = false;
public int mSuccess = 0, mTargetStackSize = 0;
- public GT_MetaTileEntity_Buffer(
- int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription) {
+ public GT_MetaTileEntity_Buffer(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount,
+ String aDescription) {
super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription);
}
- public GT_MetaTileEntity_Buffer(
- int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String[] aDescription) {
+ public GT_MetaTileEntity_Buffer(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount,
+ String[] aDescription) {
super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription);
}
- public GT_MetaTileEntity_Buffer(
- String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_Buffer(String aName, int aTier, int aInvSlotCount, String aDescription,
+ ITexture[][][] aTextures) {
super(aName, aTier, aInvSlotCount, aDescription, aTextures);
}
- public GT_MetaTileEntity_Buffer(
- String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_Buffer(String aName, int aTier, int aInvSlotCount, String[] aDescription,
+ ITexture[][][] aTextures) {
super(aName, aTier, aInvSlotCount, aDescription, aTextures);
}
@@ -60,37 +61,28 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM
ITexture[][][] rTextures = new ITexture[ForgeDirection.VALID_DIRECTIONS.length][17][];
ITexture tIcon = getOverlayIcon();
ITexture tOut = TextureFactory.of(OVERLAY_PIPE_OUT);
- ITexture tUp = TextureFactory.of(
- TextureFactory.of(ARROW_UP),
- TextureFactory.builder().addIcon(ARROW_UP_GLOW).glow().build());
- ITexture tDown = TextureFactory.of(
- TextureFactory.of(ARROW_DOWN),
- TextureFactory.builder().addIcon(ARROW_DOWN_GLOW).glow().build());
- ITexture tLeft = TextureFactory.of(
- TextureFactory.of(ARROW_LEFT),
- TextureFactory.builder().addIcon(ARROW_LEFT_GLOW).glow().build());
- ITexture tRight = TextureFactory.of(
- TextureFactory.of(ARROW_RIGHT),
- TextureFactory.builder().addIcon(ARROW_RIGHT_GLOW).glow().build());
+ ITexture tUp = TextureFactory
+ .of(TextureFactory.of(ARROW_UP), TextureFactory.builder().addIcon(ARROW_UP_GLOW).glow().build());
+ ITexture tDown = TextureFactory
+ .of(TextureFactory.of(ARROW_DOWN), TextureFactory.builder().addIcon(ARROW_DOWN_GLOW).glow().build());
+ ITexture tLeft = TextureFactory
+ .of(TextureFactory.of(ARROW_LEFT), TextureFactory.builder().addIcon(ARROW_LEFT_GLOW).glow().build());
+ ITexture tRight = TextureFactory
+ .of(TextureFactory.of(ARROW_RIGHT), TextureFactory.builder().addIcon(ARROW_RIGHT_GLOW).glow().build());
for (int i = 0; i < rTextures[0].length; i++) {
- rTextures[OUTPUT_INDEX][i] = new ITexture[] {MACHINE_CASINGS[mTier][i], tOut};
- rTextures[ARROW_RIGHT_INDEX][i] = new ITexture[] {MACHINE_CASINGS[mTier][i], tRight, tIcon};
- rTextures[ARROW_DOWN_INDEX][i] = new ITexture[] {MACHINE_CASINGS[mTier][i], tDown, tIcon};
- rTextures[ARROW_LEFT_INDEX][i] = new ITexture[] {MACHINE_CASINGS[mTier][i], tLeft, tIcon};
- rTextures[ARROW_UP_INDEX][i] = new ITexture[] {MACHINE_CASINGS[mTier][i], tUp, tIcon};
- rTextures[FRONT_INDEX][i] = new ITexture[] {MACHINE_CASINGS[mTier][i], tIcon};
+ rTextures[OUTPUT_INDEX][i] = new ITexture[] { MACHINE_CASINGS[mTier][i], tOut };
+ rTextures[ARROW_RIGHT_INDEX][i] = new ITexture[] { MACHINE_CASINGS[mTier][i], tRight, tIcon };
+ rTextures[ARROW_DOWN_INDEX][i] = new ITexture[] { MACHINE_CASINGS[mTier][i], tDown, tIcon };
+ rTextures[ARROW_LEFT_INDEX][i] = new ITexture[] { MACHINE_CASINGS[mTier][i], tLeft, tIcon };
+ rTextures[ARROW_UP_INDEX][i] = new ITexture[] { MACHINE_CASINGS[mTier][i], tUp, tIcon };
+ rTextures[FRONT_INDEX][i] = new ITexture[] { MACHINE_CASINGS[mTier][i], tIcon };
}
return rTextures;
}
@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) {
int colorIndex = aColorIndex + 1;
ForgeDirection side = ForgeDirection.VALID_DIRECTIONS[aSide];
ForgeDirection facing = ForgeDirection.VALID_DIRECTIONS[aFacing];
@@ -278,14 +270,15 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM
GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("098", "Do not regulate Item Stack Size"));
} else {
GT_Utility.sendChatToPlayer(
- aPlayer, GT_Utility.trans("099", "Regulate Item Stack Size to: ") + mTargetStackSize);
+ aPlayer,
+ GT_Utility.trans("099", "Regulate Item Stack Size to: ") + mTargetStackSize);
}
}
}
@Override
- public boolean onWrenchRightClick(
- byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY,
+ float aZ) {
aWrenchingSide = GT_Utility.getOppositeSide(aWrenchingSide);
if (getBaseMetaTileEntity().isValidFacing(aWrenchingSide)) {
getBaseMetaTileEntity().setFrontFacing(aWrenchingSide);
@@ -313,10 +306,8 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
- if (aBaseMetaTileEntity.isAllowedToWork()
- && aBaseMetaTileEntity.isServerSide()
- && (aBaseMetaTileEntity.hasWorkJustBeenEnabled()
- || aBaseMetaTileEntity.hasInventoryBeenModified()
+ if (aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.isServerSide()
+ && (aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified()
|| aTimer % 200 == 0
|| mSuccess > 0)) {
mSuccess--;
@@ -337,32 +328,30 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM
protected void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer, int stacks) {
int tCost;
- if (bStockingMode)
- tCost = GT_Utility.moveMultipleItemStacks(
- aBaseMetaTileEntity,
- aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()),
- aBaseMetaTileEntity.getBackFacing(),
- aBaseMetaTileEntity.getFrontFacing(),
- null,
- false,
- mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize,
- mTargetStackSize == 0 ? 1 : (byte) mTargetStackSize,
- (byte) 64,
- (byte) 1,
- stacks);
- else
- tCost = GT_Utility.moveMultipleItemStacks(
- aBaseMetaTileEntity,
- aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()),
- aBaseMetaTileEntity.getBackFacing(),
- aBaseMetaTileEntity.getFrontFacing(),
- null,
- false,
- (byte) 64,
- (byte) 1,
- mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize,
- mTargetStackSize == 0 ? 1 : (byte) mTargetStackSize,
- stacks);
+ if (bStockingMode) tCost = GT_Utility.moveMultipleItemStacks(
+ aBaseMetaTileEntity,
+ aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()),
+ aBaseMetaTileEntity.getBackFacing(),
+ aBaseMetaTileEntity.getFrontFacing(),
+ null,
+ false,
+ mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize,
+ mTargetStackSize == 0 ? 1 : (byte) mTargetStackSize,
+ (byte) 64,
+ (byte) 1,
+ stacks);
+ else tCost = GT_Utility.moveMultipleItemStacks(
+ aBaseMetaTileEntity,
+ aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()),
+ aBaseMetaTileEntity.getBackFacing(),
+ aBaseMetaTileEntity.getFrontFacing(),
+ null,
+ false,
+ (byte) 64,
+ (byte) 1,
+ mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize,
+ mTargetStackSize == 0 ? 1 : (byte) mTargetStackSize,
+ stacks);
if (tCost > 0 || aBaseMetaTileEntity.hasInventoryBeenModified()) {
mSuccess = 50;
@@ -420,8 +409,8 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM
}
@Override
- public boolean onSolderingToolRightClick(
- byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY,
+ float aZ) {
if (aPlayer.isSneaking()) {
// I was so proud of all this but I literally just copied code from OutputBus
bSortStacks = !bSortStacks;
@@ -440,84 +429,73 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM
}
protected void addEmitEnergyButton(ModularWindow.Builder builder) {
- builder.widget(new ButtonWidget()
- .setOnClick((clickData, widget) -> {
- bOutput = !bOutput;
- if (bOutput) {
- GT_Utility.sendChatToPlayer(
- widget.getContext().getPlayer(), GT_Utility.trans("116", "Emit Energy to Outputside"));
- } else {
- GT_Utility.sendChatToPlayer(
- widget.getContext().getPlayer(), GT_Utility.trans("117", "Don't emit Energy"));
- }
- })
- .setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_EMIT_ENERGY)
- .setPos(7, 62)
+ builder.widget(new ButtonWidget().setOnClick((clickData, widget) -> {
+ bOutput = !bOutput;
+ if (bOutput) {
+ GT_Utility.sendChatToPlayer(
+ widget.getContext().getPlayer(),
+ GT_Utility.trans("116", "Emit Energy to Outputside"));
+ } else {
+ GT_Utility.sendChatToPlayer(
+ widget.getContext().getPlayer(),
+ GT_Utility.trans("117", "Don't emit Energy"));
+ }
+ }).setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_EMIT_ENERGY).setPos(7, 62)
.setSize(18, 18));
}
protected void addEmitRedstoneButton(ModularWindow.Builder builder) {
- builder.widget(new ButtonWidget()
- .setOnClick((clickData, widget) -> {
- bRedstoneIfFull = !bRedstoneIfFull;
- if (bRedstoneIfFull) {
- GT_Utility.sendChatToPlayer(
- widget.getContext().getPlayer(),
- GT_Utility.trans("118", "Emit Redstone if no Slot is free"));
- } else {
- GT_Utility.sendChatToPlayer(
- widget.getContext().getPlayer(), GT_Utility.trans("119", "Don't emit Redstone"));
- }
- })
- .setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_EMIT_REDSTONE)
- .setPos(25, 62)
+ builder.widget(new ButtonWidget().setOnClick((clickData, widget) -> {
+ bRedstoneIfFull = !bRedstoneIfFull;
+ if (bRedstoneIfFull) {
+ GT_Utility.sendChatToPlayer(
+ widget.getContext().getPlayer(),
+ GT_Utility.trans("118", "Emit Redstone if no Slot is free"));
+ } else {
+ GT_Utility.sendChatToPlayer(
+ widget.getContext().getPlayer(),
+ GT_Utility.trans("119", "Don't emit Redstone"));
+ }
+ }).setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_EMIT_REDSTONE).setPos(25, 62)
.setSize(18, 18));
}
protected void addInvertRedstoneButton(ModularWindow.Builder builder) {
- builder.widget(new ButtonWidget()
- .setOnClick((clickData, widget) -> {
- bInvert = !bInvert;
- if (bInvert) {
- GT_Utility.sendChatToPlayer(
- widget.getContext().getPlayer(), GT_Utility.trans("120", "Invert Redstone"));
- } else {
- GT_Utility.sendChatToPlayer(
- widget.getContext().getPlayer(), GT_Utility.trans("121", "Don't invert Redstone"));
- }
- })
- .setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_INVERT_REDSTONE)
- .setPos(43, 62)
+ builder.widget(new ButtonWidget().setOnClick((clickData, widget) -> {
+ bInvert = !bInvert;
+ if (bInvert) {
+ GT_Utility
+ .sendChatToPlayer(widget.getContext().getPlayer(), GT_Utility.trans("120", "Invert Redstone"));
+ } else {
+ GT_Utility.sendChatToPlayer(
+ widget.getContext().getPlayer(),
+ GT_Utility.trans("121", "Don't invert Redstone"));
+ }
+ }).setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_INVERT_REDSTONE).setPos(43, 62)
.setSize(18, 18));
}
protected void addStockingModeButton(ModularWindow.Builder builder) {
- builder.widget(new ButtonWidget()
- .setOnClick((clickData, widget) -> {
- bStockingMode = !bStockingMode;
- if (bStockingMode) {
- GT_Utility.sendChatToPlayer(
- widget.getContext().getPlayer(),
- GT_Utility.trans(
- "217",
- "Stocking mode. Keeps this many items in destination input slots. This mode can be server unfriendly."));
- } else {
- GT_Utility.sendChatToPlayer(
- widget.getContext().getPlayer(),
- GT_Utility.trans(
- "218",
- "Transfer size mode. Add exactly this many items in destination input slots as long as there is room."));
- }
- })
- .setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_STOCKING_MODE)
- .setPos(61, 62)
+ builder.widget(new ButtonWidget().setOnClick((clickData, widget) -> {
+ bStockingMode = !bStockingMode;
+ if (bStockingMode) {
+ GT_Utility.sendChatToPlayer(
+ widget.getContext().getPlayer(),
+ GT_Utility.trans(
+ "217",
+ "Stocking mode. Keeps this many items in destination input slots. This mode can be server unfriendly."));
+ } else {
+ GT_Utility.sendChatToPlayer(
+ widget.getContext().getPlayer(),
+ GT_Utility.trans(
+ "218",
+ "Transfer size mode. Add exactly this many items in destination input slots as long as there is room."));
+ }
+ }).setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_STOCKING_MODE).setPos(61, 62)
.setSize(18, 18));
}
protected void addInventorySlots(ModularWindow.Builder builder) {
- builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 9)
- .endAtSlot(26)
- .build()
- .setPos(7, 4));
+ builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 9).endAtSlot(26).build().setPos(7, 4));
}
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java
index 3e3433e52c..830706f8fe 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java
@@ -6,62 +6,63 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElement
import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
import static gregtech.api.enums.GT_HatchElement.*;
+import java.util.List;
+
+import net.minecraft.item.ItemStack;
+
import com.google.common.collect.ImmutableList;
import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.IStructureElement;
import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+
import gregtech.api.interfaces.IHatchElement;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.util.GT_StructureUtility;
-import java.util.List;
-import net.minecraft.item.ItemStack;
/**
- * A simple 3x3x3 hollow cubic multiblock, that can be arbitrarily rotated, made of a single type of machine casing and accepts hatches everywhere.
- * Controller will be placed in front center of the structure.
+ * A simple 3x3x3 hollow cubic multiblock, that can be arbitrarily rotated, made of a single type of machine casing and
+ * accepts hatches everywhere. Controller will be placed in front center of the structure.
* <p>
- * Note: You cannot use different casing for the same Class. Make a new subclass for it. You also should not change the casing
- * dynamically, i.e. it should be a dumb method returning some sort of constant.
+ * Note: You cannot use different casing for the same Class. Make a new subclass for it. You also should not change the
+ * casing dynamically, i.e. it should be a dumb method returning some sort of constant.
* <p>
- * Implementation tips:
- * 1. To restrict hatches, override {@link #addDynamoToMachineList(IGregTechTileEntity, int)} and its cousins instead of overriding the whole
- * {@link #getStructureDefinition()} or change {@link #checkHatches(IGregTechTileEntity, ItemStack)}. The former is a total overkill, while the later cannot
- * stop the structure check early.
- * 2. To limit rotation, override {@link #getInitialAlignmentLimits()}
+ * Implementation tips: 1. To restrict hatches, override {@link #addDynamoToMachineList(IGregTechTileEntity, int)} and
+ * its cousins instead of overriding the whole {@link #getStructureDefinition()} or change
+ * {@link #checkHatches(IGregTechTileEntity, ItemStack)}. The former is a total overkill, while the later cannot stop
+ * the structure check early. 2. To limit rotation, override {@link #getInitialAlignmentLimits()}
*
* @param <T>
*/
public abstract class GT_MetaTileEntity_CubicMultiBlockBase<T extends GT_MetaTileEntity_CubicMultiBlockBase<T>>
extends GT_MetaTileEntity_EnhancedMultiBlockBase<T> implements ISurvivalConstructable {
+
protected static final String STRUCTURE_PIECE_MAIN = "main";
- protected static final ClassValue<IStructureDefinition<GT_MetaTileEntity_CubicMultiBlockBase<?>>>
- STRUCTURE_DEFINITION = new ClassValue<IStructureDefinition<GT_MetaTileEntity_CubicMultiBlockBase<?>>>() {
- @Override
- protected IStructureDefinition<GT_MetaTileEntity_CubicMultiBlockBase<?>> computeValue(Class<?> type) {
- return StructureDefinition.<GT_MetaTileEntity_CubicMultiBlockBase<?>>builder()
- .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][] {
- {"hhh", "hhh", "hhh"},
- {"h~h", "h-h", "hhh"},
- {"hhh", "hhh", "hhh"},
- }))
- .addElement(
- 'h',
- ofChain(
- lazy(t ->
- GT_StructureUtility
- .<GT_MetaTileEntity_CubicMultiBlockBase<?>>buildHatchAdder()
- .atLeastList(t.getAllowedHatches())
- .casingIndex(t.getHatchTextureIndex())
- .dot(1)
- .build()),
- onElementPass(
- GT_MetaTileEntity_CubicMultiBlockBase::onCorrectCasingAdded,
- lazy(GT_MetaTileEntity_CubicMultiBlockBase::getCasingElement))))
- .build();
- }
- };
+ protected static final ClassValue<IStructureDefinition<GT_MetaTileEntity_CubicMultiBlockBase<?>>> STRUCTURE_DEFINITION = new ClassValue<IStructureDefinition<GT_MetaTileEntity_CubicMultiBlockBase<?>>>() {
+
+ @Override
+ protected IStructureDefinition<GT_MetaTileEntity_CubicMultiBlockBase<?>> computeValue(Class<?> type) {
+ return StructureDefinition.<GT_MetaTileEntity_CubicMultiBlockBase<?>>builder()
+ .addShape(
+ STRUCTURE_PIECE_MAIN,
+ transpose(
+ new String[][] { { "hhh", "hhh", "hhh" }, { "h~h", "h-h", "hhh" },
+ { "hhh", "hhh", "hhh" }, }))
+ .addElement(
+ 'h',
+ ofChain(
+ lazy(
+ t -> GT_StructureUtility
+ .<GT_MetaTileEntity_CubicMultiBlockBase<?>>buildHatchAdder()
+ .atLeastList(t.getAllowedHatches())
+ .casingIndex(t.getHatchTextureIndex()).dot(1).build()),
+ onElementPass(
+ GT_MetaTileEntity_CubicMultiBlockBase::onCorrectCasingAdded,
+ lazy(GT_MetaTileEntity_CubicMultiBlockBase::getCasingElement))))
+ .build();
+ }
+ };
private int mCasingAmount = 0;
protected GT_MetaTileEntity_CubicMultiBlockBase(int aID, String aName, String aNameRegional) {
@@ -73,7 +74,8 @@ public abstract class GT_MetaTileEntity_CubicMultiBlockBase<T extends GT_MetaTil
}
/**
- * Create a simple 3x3x3 hollow cubic structure made of a single type of machine casing and accepts hatches everywhere.
+ * Create a simple 3x3x3 hollow cubic structure made of a single type of machine casing and accepts hatches
+ * everywhere.
* <p>
* The created definition contains a single piece named {@link #STRUCTURE_PIECE_MAIN}.
*/
@@ -97,8 +99,7 @@ public abstract class GT_MetaTileEntity_CubicMultiBlockBase<T extends GT_MetaTil
@Override
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
mCasingAmount = 0;
- return checkPiece(STRUCTURE_PIECE_MAIN, 1, 1, 0)
- && mCasingAmount >= getRequiredCasingCount()
+ return checkPiece(STRUCTURE_PIECE_MAIN, 1, 1, 0) && mCasingAmount >= getRequiredCasingCount()
&& checkHatches(aBaseMetaTileEntity, aStack);
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
index 32f607c0a7..0b1827bcdb 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
@@ -1,5 +1,11 @@
package gregtech.api.metatileentity.implementations;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.common.util.ForgeDirection;
+
import com.gtnewhorizon.structurelib.StructureLibAPI;
import com.gtnewhorizon.structurelib.alignment.IAlignment;
import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits;
@@ -11,25 +17,22 @@ import com.gtnewhorizon.structurelib.alignment.enumerable.Rotation;
import com.gtnewhorizon.structurelib.structure.IItemSource;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment;
+
import cpw.mods.fml.common.network.NetworkRegistry;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraftforge.common.util.ForgeDirection;
/**
* Enhanced multiblock base class, featuring following improvement over {@link GT_MetaTileEntity_MultiBlockBase}
* <p>
- * 1. TecTech style declarative structure check utilizing StructureLib.
- * 2. Arbitrarily rotating the whole structure, if allowed to.
+ * 1. TecTech style declarative structure check utilizing StructureLib. 2. Arbitrarily rotating the whole structure, if
+ * allowed to.
*
* @param <T> type of this
*/
public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase<T extends GT_MetaTileEntity_EnhancedMultiBlockBase<T>>
extends GT_MetaTileEntity_TooltipMultiBlockBase implements IAlignment, IConstructable {
+
private ExtendedFacing mExtendedFacing = ExtendedFacing.DEFAULT;
private IAlignmentLimits mLimits = getInitialAlignmentLimits();
@@ -76,8 +79,8 @@ public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase<T extends GT_Meta
}
@Override
- public boolean onWrenchRightClick(
- byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY,
+ float aZ) {
if (aWrenchingSide != getBaseMetaTileEntity().getFrontFacing())
return super.onWrenchRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ);
if (aPlayer.isSneaking()) {
@@ -106,9 +109,9 @@ public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase<T extends GT_Meta
}
/**
- * Due to limitation of Java type system, you might need to do an unchecked cast.
- * HOWEVER, the returned IStructureDefinition is expected to be evaluated against current instance only, and should
- * not be used against other instances, even for those of the same class.
+ * Due to limitation of Java type system, you might need to do an unchecked cast. HOWEVER, the returned
+ * IStructureDefinition is expected to be evaluated against current instance only, and should not be used against
+ * other instances, even for those of the same class.
*/
public abstract IStructureDefinition<T> getStructureDefinition();
@@ -149,142 +152,118 @@ public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase<T extends GT_Meta
*
* Imagine you stand in front of the controller, with controller facing towards you not rotated or flipped.
*
- * The horizontalOffset would be the number of blocks on the left side of the controller, not counting controller itself.
- * The verticalOffset would be the number of blocks on the top side of the controller, not counting controller itself.
- * The depthOffset would be the number of blocks between you and controller, not counting controller itself.
+ * The horizontalOffset would be the number of blocks on the left side of the controller, not counting controller
+ * itself. The verticalOffset would be the number of blocks on the top side of the controller, not counting
+ * controller itself. The depthOffset would be the number of blocks between you and controller, not counting
+ * controller itself.
*
* All these offsets can be negative.
*/
protected final boolean checkPiece(String piece, int horizontalOffset, int verticalOffset, int depthOffset) {
final IGregTechTileEntity tTile = getBaseMetaTileEntity();
- return getCastedStructureDefinition()
- .check(
- this,
- piece,
- tTile.getWorld(),
- getExtendedFacing(),
- tTile.getXCoord(),
- tTile.getYCoord(),
- tTile.getZCoord(),
- horizontalOffset,
- verticalOffset,
- depthOffset,
- !mMachine);
+ return getCastedStructureDefinition().check(
+ this,
+ piece,
+ tTile.getWorld(),
+ getExtendedFacing(),
+ tTile.getXCoord(),
+ tTile.getYCoord(),
+ tTile.getZCoord(),
+ horizontalOffset,
+ verticalOffset,
+ depthOffset,
+ !mMachine);
}
- protected final boolean buildPiece(
- String piece,
- ItemStack trigger,
- boolean hintOnly,
- int horizontalOffset,
- int verticalOffset,
- int depthOffset) {
+ protected final boolean buildPiece(String piece, ItemStack trigger, boolean hintOnly, int horizontalOffset,
+ int verticalOffset, int depthOffset) {
final IGregTechTileEntity tTile = getBaseMetaTileEntity();
- return getCastedStructureDefinition()
- .buildOrHints(
- this,
- trigger,
- piece,
- tTile.getWorld(),
- getExtendedFacing(),
- tTile.getXCoord(),
- tTile.getYCoord(),
- tTile.getZCoord(),
- horizontalOffset,
- verticalOffset,
- depthOffset,
- hintOnly);
+ return getCastedStructureDefinition().buildOrHints(
+ this,
+ trigger,
+ piece,
+ tTile.getWorld(),
+ getExtendedFacing(),
+ tTile.getXCoord(),
+ tTile.getYCoord(),
+ tTile.getZCoord(),
+ horizontalOffset,
+ verticalOffset,
+ depthOffset,
+ hintOnly);
}
@Deprecated
- protected final int survivialBuildPiece(
- String piece,
- ItemStack trigger,
- int horizontalOffset,
- int verticalOffset,
- int depthOffset,
- int elementsBudget,
- IItemSource source,
- EntityPlayerMP actor,
- boolean check) {
+ protected final int survivialBuildPiece(String piece, ItemStack trigger, int horizontalOffset, int verticalOffset,
+ int depthOffset, int elementsBudget, IItemSource source, EntityPlayerMP actor, boolean check) {
final IGregTechTileEntity tTile = getBaseMetaTileEntity();
- return getCastedStructureDefinition()
- .survivalBuild(
- this,
- trigger,
- piece,
- tTile.getWorld(),
- getExtendedFacing(),
- tTile.getXCoord(),
- tTile.getYCoord(),
- tTile.getZCoord(),
- horizontalOffset,
- verticalOffset,
- depthOffset,
- elementsBudget,
- source,
- actor,
- check);
+ return getCastedStructureDefinition().survivalBuild(
+ this,
+ trigger,
+ piece,
+ tTile.getWorld(),
+ getExtendedFacing(),
+ tTile.getXCoord(),
+ tTile.getYCoord(),
+ tTile.getZCoord(),
+ horizontalOffset,
+ verticalOffset,
+ depthOffset,
+ elementsBudget,
+ source,
+ actor,
+ check);
}
- protected final int survivialBuildPiece(
- String piece,
- ItemStack trigger,
- int horizontalOffset,
- int verticalOffset,
- int depthOffset,
- int elementsBudget,
- ISurvivalBuildEnvironment env,
- boolean check) {
+ protected final int survivialBuildPiece(String piece, ItemStack trigger, int horizontalOffset, int verticalOffset,
+ int depthOffset, int elementsBudget, ISurvivalBuildEnvironment env, boolean check) {
final IGregTechTileEntity tTile = getBaseMetaTileEntity();
- return getCastedStructureDefinition()
- .survivalBuild(
- this,
- trigger,
- piece,
- tTile.getWorld(),
- getExtendedFacing(),
- tTile.getXCoord(),
- tTile.getYCoord(),
- tTile.getZCoord(),
- horizontalOffset,
- verticalOffset,
- depthOffset,
- elementsBudget,
- env,
- check);
+ return getCastedStructureDefinition().survivalBuild(
+ this,
+ trigger,
+ piece,
+ tTile.getWorld(),
+ getExtendedFacing(),
+ tTile.getXCoord(),
+ tTile.getYCoord(),
+ tTile.getZCoord(),
+ horizontalOffset,
+ verticalOffset,
+ depthOffset,
+ elementsBudget,
+ env,
+ check);
}
@Deprecated
- protected final int survivialBuildPiece(
- String piece,
- ItemStack trigger,
- int horizontalOffset,
- int verticalOffset,
- int depthOffset,
- int elementsBudget,
- IItemSource source,
- EntityPlayerMP actor,
- boolean check,
+ protected final int survivialBuildPiece(String piece, ItemStack trigger, int horizontalOffset, int verticalOffset,
+ int depthOffset, int elementsBudget, IItemSource source, EntityPlayerMP actor, boolean check,
boolean checkIfPlaced) {
int built = survivialBuildPiece(
- piece, trigger, horizontalOffset, verticalOffset, depthOffset, elementsBudget, source, actor, check);
+ piece,
+ trigger,
+ horizontalOffset,
+ verticalOffset,
+ depthOffset,
+ elementsBudget,
+ source,
+ actor,
+ check);
if (checkIfPlaced && built > 0) checkStructure(true, getBaseMetaTileEntity());
return built;
}
- protected final int survivialBuildPiece(
- String piece,
- ItemStack trigger,
- int horizontalOffset,
- int verticalOffset,
- int depthOffset,
- int elementsBudget,
- ISurvivalBuildEnvironment env,
- boolean check,
- boolean checkIfPlaced) {
+ protected final int survivialBuildPiece(String piece, ItemStack trigger, int horizontalOffset, int verticalOffset,
+ int depthOffset, int elementsBudget, ISurvivalBuildEnvironment env, boolean check, boolean checkIfPlaced) {
int built = survivialBuildPiece(
- piece, trigger, horizontalOffset, verticalOffset, depthOffset, elementsBudget, env, check);
+ piece,
+ trigger,
+ horizontalOffset,
+ verticalOffset,
+ depthOffset,
+ elementsBudget,
+ env,
+ check);
if (checkIfPlaced && built > 0) checkStructure(true, getBaseMetaTileEntity());
return built;
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ExtendedPowerMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ExtendedPowerMultiBlockBase.java
index 329ba45df5..11f3eeb9cc 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ExtendedPowerMultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ExtendedPowerMultiBlockBase.java
@@ -2,11 +2,9 @@ package gregtech.api.metatileentity.implementations;
import static gregtech.api.enums.GT_Values.*;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.util.GT_ExoticEnergyInputHelper;
-import gregtech.api.util.GT_Utility;
import java.util.ArrayList;
import java.util.List;
+
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -15,11 +13,14 @@ import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GT_ExoticEnergyInputHelper;
+import gregtech.api.util.GT_Utility;
+
/**
* Multiblock base class that allows machine to use power over int.
*/
-public abstract class GT_MetaTileEntity_ExtendedPowerMultiBlockBase<
- T extends GT_MetaTileEntity_EnhancedMultiBlockBase<T>>
+public abstract class GT_MetaTileEntity_ExtendedPowerMultiBlockBase<T extends GT_MetaTileEntity_EnhancedMultiBlockBase<T>>
extends GT_MetaTileEntity_EnhancedMultiBlockBase<T> {
public long lEUt;
@@ -46,8 +47,8 @@ public abstract class GT_MetaTileEntity_ExtendedPowerMultiBlockBase<
}
@Override
- protected void calculateOverclockedNessMultiInternal(
- long aEUt, int aDuration, int mAmperage, long maxInputVoltage, boolean perfectOC) {
+ protected void calculateOverclockedNessMultiInternal(long aEUt, int aDuration, int mAmperage, long maxInputVoltage,
+ boolean perfectOC) {
// 5% space for cable loss
long zMaxInputVoltage = maxInputVoltage / 100L * 95L;
long zTime = aDuration;
@@ -112,8 +113,8 @@ public abstract class GT_MetaTileEntity_ExtendedPowerMultiBlockBase<
}
@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);
final IGregTechTileEntity tileEntity = getBaseMetaTileEntity();
@@ -145,29 +146,57 @@ public abstract class GT_MetaTileEntity_ExtendedPowerMultiBlockBase<
long amps = getMaxInputAmps();
return new String[] {
- /* 1*/ StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + EnumChatFormatting.GREEN
- + GT_Utility.formatNumbers(mProgresstime / 20) + EnumChatFormatting.RESET + " s / "
- + EnumChatFormatting.YELLOW
- + GT_Utility.formatNumbers(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s",
- /* 2*/ StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + EnumChatFormatting.GREEN
- + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / "
- + EnumChatFormatting.YELLOW
- + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU",
- /* 3*/ StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " + EnumChatFormatting.RED
- + GT_Utility.formatNumbers(getActualEnergyUsage()) + EnumChatFormatting.RESET + " EU/t",
- /* 4*/ StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + EnumChatFormatting.YELLOW
- + GT_Utility.formatNumbers(voltage) + EnumChatFormatting.RESET + " EU/t(*" + amps + " A)"
- + StatCollector.translateToLocal("GT5U.machines.tier")
- + ": " + EnumChatFormatting.YELLOW
- + VN[GT_Utility.getTier(voltage)] + EnumChatFormatting.RESET,
- /* 5*/ StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " + EnumChatFormatting.RED
- + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " "
- + StatCollector.translateToLocal("GT5U.multiblock.efficiency")
- + ": " + EnumChatFormatting.YELLOW
- + Float.toString(mEfficiency / 100.0F) + EnumChatFormatting.RESET + " %",
- /* 6*/ StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " + EnumChatFormatting.GREEN
- + mPollutionReduction + EnumChatFormatting.RESET + " %"
- };
+ /* 1 */ StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": "
+ + EnumChatFormatting.GREEN
+ + GT_Utility.formatNumbers(mProgresstime / 20)
+ + EnumChatFormatting.RESET
+ + " s / "
+ + EnumChatFormatting.YELLOW
+ + GT_Utility.formatNumbers(mMaxProgresstime / 20)
+ + EnumChatFormatting.RESET
+ + " s",
+ /* 2 */ StatCollector.translateToLocal("GT5U.multiblock.energy") + ": "
+ + EnumChatFormatting.GREEN
+ + GT_Utility.formatNumbers(storedEnergy)
+ + EnumChatFormatting.RESET
+ + " EU / "
+ + EnumChatFormatting.YELLOW
+ + GT_Utility.formatNumbers(maxEnergy)
+ + EnumChatFormatting.RESET
+ + " EU",
+ /* 3 */ StatCollector.translateToLocal("GT5U.multiblock.usage") + ": "
+ + EnumChatFormatting.RED
+ + GT_Utility.formatNumbers(getActualEnergyUsage())
+ + EnumChatFormatting.RESET
+ + " EU/t",
+ /* 4 */ StatCollector.translateToLocal("GT5U.multiblock.mei") + ": "
+ + EnumChatFormatting.YELLOW
+ + GT_Utility.formatNumbers(voltage)
+ + EnumChatFormatting.RESET
+ + " EU/t(*"
+ + amps
+ + " A)"
+ + StatCollector.translateToLocal("GT5U.machines.tier")
+ + ": "
+ + EnumChatFormatting.YELLOW
+ + VN[GT_Utility.getTier(voltage)]
+ + EnumChatFormatting.RESET,
+ /* 5 */ StatCollector.translateToLocal("GT5U.multiblock.problems") + ": "
+ + EnumChatFormatting.RED
+ + (getIdealStatus() - getRepairStatus())
+ + EnumChatFormatting.RESET
+ + " "
+ + StatCollector.translateToLocal("GT5U.multiblock.efficiency")
+ + ": "
+ + EnumChatFormatting.YELLOW
+ + Float.toString(mEfficiency / 100.0F)
+ + EnumChatFormatting.RESET
+ + " %",
+ /* 6 */ StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": "
+ + EnumChatFormatting.GREEN
+ + mPollutionReduction
+ + EnumChatFormatting.RESET
+ + " %" };
}
@Override
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java
index f1ccdd04e4..a8e505b806 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java
@@ -1,10 +1,11 @@
package gregtech.api.metatileentity.implementations;
+import net.minecraft.nbt.NBTTagCompound;
+
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import net.minecraft.nbt.NBTTagCompound;
/**
* Handles texture changes internally. No special calls are necessary other than updateTexture in add***ToMachineList.
@@ -26,35 +27,23 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan
private byte mTexturePage = 0;
private byte actualTexture = 0;
- public GT_MetaTileEntity_Hatch(
- int aID,
- String aName,
- String aNameRegional,
- int aTier,
- int aInvSlotCount,
- String aDescription,
- ITexture... aTextures) {
+ public GT_MetaTileEntity_Hatch(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount,
+ String aDescription, ITexture... aTextures) {
super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures);
}
- public GT_MetaTileEntity_Hatch(
- int aID,
- String aName,
- String aNameRegional,
- int aTier,
- int aInvSlotCount,
- String[] aDescription,
- ITexture... aTextures) {
+ public GT_MetaTileEntity_Hatch(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount,
+ String[] aDescription, ITexture... aTextures) {
super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures);
}
- public GT_MetaTileEntity_Hatch(
- String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_Hatch(String aName, int aTier, int aInvSlotCount, String aDescription,
+ ITexture[][][] aTextures) {
super(aName, aTier, aInvSlotCount, aDescription, aTextures);
}
- public GT_MetaTileEntity_Hatch(
- String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_Hatch(String aName, int aTier, int aInvSlotCount, String[] aDescription,
+ ITexture[][][] aTextures) {
super(aName, aTier, aInvSlotCount, aDescription, aTextures);
}
@@ -72,35 +61,29 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan
public abstract ITexture[] getTexturesInactive(ITexture aBaseTexture);
@Override
- public ITexture[] getTexture(
- IGregTechTileEntity aBaseMetaTileEntity,
- byte aSide,
- byte aFacing,
- byte aColorIndex,
- boolean aActive,
- boolean aRedstone) {
- int texturePointer =
- (byte) (actualTexture & 0x7F); // just to be sure, from my testing the 8th bit cannot be set clientside
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex,
+ boolean aActive, boolean aRedstone) {
+ int texturePointer = (byte) (actualTexture & 0x7F); // just to be sure, from my testing the 8th bit cannot be
+ // set clientside
int textureIndex = texturePointer | (mTexturePage << 7); // Shift seven since one page is 128 textures!
try {
if (aSide != aFacing) {
if (textureIndex > 0)
- return new ITexture[] {Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]};
- else return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]};
+ return new ITexture[] { Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer] };
+ else return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1] };
} else {
if (textureIndex > 0) {
if (aActive)
return getTexturesActive(Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]);
- else
- return getTexturesInactive(
- Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]);
+ else return getTexturesInactive(
+ Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]);
} else {
if (aActive) return getTexturesActive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]);
else return getTexturesInactive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]);
}
}
} catch (NullPointerException npe) {
- return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[0][0]};
+ return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[0][0] };
}
}
@@ -117,13 +100,15 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan
actualTexture = aNBT.getByte("mMachineBlock");
mTexturePage = aNBT.getByte("mTexturePage");
- if (mTexturePage != 0 && GT_Values.GT.isServerSide())
- actualTexture |= 0x80; // <- lets just hope no one needs the correct value for that on server
+ if (mTexturePage != 0 && GT_Values.GT.isServerSide()) actualTexture |= 0x80; // <- lets just hope no one needs
+ // the correct value for that on
+ // server
mMachineBlock = actualTexture;
}
/**
* Sets texture with page and index, called on add to machine list
+ *
* @param id (page<<7)+index of the texture
*/
public final void updateTexture(int id) {
@@ -133,7 +118,8 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan
/**
* Sets texture with page and index, rather unusable, but kept FFS
- * @param page page of texure
+ *
+ * @param page page of texure
* @param index index of texure
*/
@Deprecated
@@ -149,7 +135,8 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan
mTexturePage = 0;
}
- /** Get the maximum amount of amperes to work with, which excludes the additional amps in for loss
+ /**
+ * Get the maximum amount of amperes to work with, which excludes the additional amps in for loss
*
* @return Working amps
*/
@@ -157,7 +144,8 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan
return maxAmperesIn();
}
- /** Get the type of connection this hatch allows
+ /**
+ * Get the type of connection this hatch allows
*
* @return Connection type
*/
@@ -215,13 +203,13 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan
}
@Override
- public void onPreTick(
- IGregTechTileEntity aBaseMetaTileEntity,
- long aTick) { // in that method since it is usually not overriden, especially for hatches.
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { // in that method since it is usually
+ // not overriden, especially for
+ // hatches.
if (actualTexture != mMachineBlock) { // revert to page 0 on edition of the field - old code way
actualTexture = (byte) (mMachineBlock & 0x7F);
- mMachineBlock =
- actualTexture; // clear last bit in mMachineBlock since now we are at page 0 after the direct field
+ mMachineBlock = actualTexture; // clear last bit in mMachineBlock since now we are at page 0 after the
+ // direct field
// change
mTexturePage = 0; // assuming old code only supports page 0
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DataAccess.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DataAccess.java
index e60ffe0f58..fc25a15beb 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DataAccess.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DataAccess.java
@@ -2,8 +2,13 @@ package gregtech.api.metatileentity.implementations;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_DATA_ACCESS;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
+
import gregtech.api.gui.modularui.GT_UIInfos;
import gregtech.api.gui.modularui.GT_UITextures;
import gregtech.api.interfaces.ITexture;
@@ -12,36 +17,39 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_AssemblyLineUtils;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
public class GT_MetaTileEntity_Hatch_DataAccess extends GT_MetaTileEntity_Hatch implements IAddUIWidgets {
+
private int timeout = 4;
public GT_MetaTileEntity_Hatch_DataAccess(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 16, new String[] {
- "Data Access for Multiblocks", "Adds " + (aTier == 4 ? 4 : 16) + " extra slots for Data Sticks"
- });
+ super(
+ aID,
+ aName,
+ aNameRegional,
+ aTier,
+ 16,
+ new String[] { "Data Access for Multiblocks",
+ "Adds " + (aTier == 4 ? 4 : 16) + " extra slots for Data Sticks" });
}
public GT_MetaTileEntity_Hatch_DataAccess(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
super(aName, aTier, aTier == 4 ? 4 : 16, aDescription, aTextures);
}
- public GT_MetaTileEntity_Hatch_DataAccess(
- String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_Hatch_DataAccess(String aName, int aTier, String[] aDescription,
+ ITexture[][][] aTextures) {
super(aName, aTier, aTier == 4 ? 4 : 16, aDescription, aTextures);
}
@Override
public ITexture[] getTexturesActive(ITexture aBaseTexture) {
- return new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_DATA_ACCESS)};
+ return new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_DATA_ACCESS) };
}
@Override
public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
- return new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_DATA_ACCESS)};
+ return new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_DATA_ACCESS) };
}
@Override
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Dynamo.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Dynamo.java
index e9ba5ec512..84c1327a91 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Dynamo.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Dynamo.java
@@ -2,22 +2,28 @@ package gregtech.api.metatileentity.implementations;
import static gregtech.api.enums.GT_Values.V;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
public class GT_MetaTileEntity_Hatch_Dynamo extends GT_MetaTileEntity_Hatch {
+
public GT_MetaTileEntity_Hatch_Dynamo(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 0, new String[] {
- "Generating electric Energy from Multiblocks", "Puts out up to 1 Amp"
- });
+ super(
+ aID,
+ aName,
+ aNameRegional,
+ aTier,
+ 0,
+ new String[] { "Generating electric Energy from Multiblocks", "Puts out up to 1 Amp" });
}
- public GT_MetaTileEntity_Hatch_Dynamo(
- int aID, String aName, String aNameRegional, int aTier, String[] aDescription) {
+ public GT_MetaTileEntity_Hatch_Dynamo(int aID, String aName, String aNameRegional, int aTier,
+ String[] aDescription) {
super(aID, aName, aNameRegional, aTier, 0, aDescription);
}
@@ -31,12 +37,12 @@ public class GT_MetaTileEntity_Hatch_Dynamo extends GT_MetaTileEntity_Hatch {
@Override
public ITexture[] getTexturesActive(ITexture aBaseTexture) {
- return new ITexture[] {aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]};
+ return new ITexture[] { aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier] };
}
@Override
public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
- return new ITexture[] {aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]};
+ return new ITexture[] { aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier] };
}
@Override
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy.java
index 1b4def6dc3..dda6fb5716 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy.java
@@ -2,34 +2,33 @@ package gregtech.api.metatileentity.implementations;
import static gregtech.api.enums.GT_Values.V;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
public class GT_MetaTileEntity_Hatch_Energy extends GT_MetaTileEntity_Hatch {
- public GT_MetaTileEntity_Hatch_Energy(
- int aID, String aName, String aNameRegional, int aTier, String[] aDescription) {
+ public GT_MetaTileEntity_Hatch_Energy(int aID, String aName, String aNameRegional, int aTier,
+ String[] aDescription) {
super(aID, aName, aNameRegional, aTier, 0, aDescription);
}
public GT_MetaTileEntity_Hatch_Energy(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 0, new String[] {
- "Energy Injector for Multiblocks", "Accepts up to 2 Amps"
- });
- }
-
- public GT_MetaTileEntity_Hatch_Energy(
- int aID,
- String aName,
- String aNameRegional,
- int aTier,
- int aInvSlotCount,
- String[] aDescription,
- ITexture... aTextures) {
+ super(
+ aID,
+ aName,
+ aNameRegional,
+ aTier,
+ 0,
+ new String[] { "Energy Injector for Multiblocks", "Accepts up to 2 Amps" });
+ }
+
+ public GT_MetaTileEntity_Hatch_Energy(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount,
+ String[] aDescription, ITexture... aTextures) {
super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures);
}
@@ -41,19 +40,19 @@ public class GT_MetaTileEntity_Hatch_Energy extends GT_MetaTileEntity_Hatch {
super(aName, aTier, 0, aDescription, aTextures);
}
- public GT_MetaTileEntity_Hatch_Energy(
- String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_Hatch_Energy(String aName, int aTier, int aInvSlotCount, String[] aDescription,
+ ITexture[][][] aTextures) {
super(aName, aTier, aInvSlotCount, aDescription, aTextures);
}
@Override
public ITexture[] getTexturesActive(ITexture aBaseTexture) {
- return new ITexture[] {aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier]};
+ return new ITexture[] { aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier] };
}
@Override
public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
- return new ITexture[] {aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier]};
+ return new ITexture[] { aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier] };
}
@Override
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java
index ead36c10ab..4b53946e7a 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java
@@ -3,6 +3,11 @@ package gregtech.api.metatileentity.implementations;
import static gregtech.api.enums.Textures.BlockIcons.FLUID_IN_SIGN;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_IN;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fluids.FluidStack;
+
import gregtech.GT_Mod;
import gregtech.api.gui.modularui.GT_UIInfos;
import gregtech.api.interfaces.ITexture;
@@ -11,26 +16,32 @@ import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraftforge.fluids.FluidStack;
public class GT_MetaTileEntity_Hatch_Input extends GT_MetaTileEntity_Hatch {
+
public GT_Recipe_Map mRecipeMap = null;
public GT_MetaTileEntity_Hatch_Input(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 3, new String[] {
- "Fluid Input for Multiblocks", "Capacity: " + GT_Utility.formatNumbers(8000 * (1 << aTier)) + "L"
- });
+ super(
+ aID,
+ aName,
+ aNameRegional,
+ aTier,
+ 3,
+ new String[] { "Fluid Input for Multiblocks",
+ "Capacity: " + GT_Utility.formatNumbers(8000 * (1 << aTier)) + "L" });
}
public GT_MetaTileEntity_Hatch_Input(int aID, int aSlot, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, aSlot, new String[] {
- "Fluid Input for Multiblocks",
- "Capacity: " + GT_Utility.formatNumbers(8000 * (1 << aTier) / aSlot) + "L",
- "Can hold " + aSlot + " types of fluid."
- });
+ super(
+ aID,
+ aName,
+ aNameRegional,
+ aTier,
+ aSlot,
+ new String[] { "Fluid Input for Multiblocks",
+ "Capacity: " + GT_Utility.formatNumbers(8000 * (1 << aTier) / aSlot) + "L",
+ "Can hold " + aSlot + " types of fluid." });
}
public GT_MetaTileEntity_Hatch_Input(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
@@ -41,23 +52,23 @@ public class GT_MetaTileEntity_Hatch_Input extends GT_MetaTileEntity_Hatch {
super(aName, aTier, 3, aDescription, aTextures);
}
- public GT_MetaTileEntity_Hatch_Input(
- String aName, int aSlots, int aTier, String[] aDescription, ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_Hatch_Input(String aName, int aSlots, int aTier, String[] aDescription,
+ ITexture[][][] aTextures) {
super(aName, aTier, aSlots, aDescription, aTextures);
}
@Override
public ITexture[] getTexturesActive(ITexture aBaseTexture) {
return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch
- ? new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(FLUID_IN_SIGN)}
- : new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN)};
+ ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(FLUID_IN_SIGN) }
+ : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN) };
}
@Override
public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch
- ? new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(FLUID_IN_SIGN)}
- : new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN)};
+ ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(FLUID_IN_SIGN) }
+ : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN) };
}
@Override
@@ -146,10 +157,8 @@ public class GT_MetaTileEntity_Hatch_Input extends GT_MetaTileEntity_Hatch {
@Override
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return aSide == aBaseMetaTileEntity.getFrontFacing()
- && aIndex == 0
- && (mRecipeMap == null
- || mRecipeMap.containsInput(aStack)
+ return aSide == aBaseMetaTileEntity.getFrontFacing() && aIndex == 0
+ && (mRecipeMap == null || mRecipeMap.containsInput(aStack)
|| mRecipeMap.containsInput(GT_Utility.getFluidForFilledItem(aStack, true)));
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java
index fdedbad86a..959bcda530 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java
@@ -2,8 +2,18 @@ package gregtech.api.metatileentity.implementations;
import static gregtech.api.enums.Textures.BlockIcons.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.StatCollector;
+
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
+
import gregtech.GT_Mod;
import gregtech.api.gui.modularui.GT_UIInfos;
import gregtech.api.interfaces.IConfigurationCircuitSupport;
@@ -17,16 +27,10 @@ import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
import gregtech.api.util.extensions.ArrayExt;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.util.StatCollector;
public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch
implements IConfigurationCircuitSupport, IAddUIWidgets {
+
public GT_Recipe_Map mRecipeMap = null;
public boolean disableSort;
public boolean disableFilter = true;
@@ -36,8 +40,8 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch
this(id, name, nameRegional, tier, getSlots(tier) + 1);
}
- protected GT_MetaTileEntity_Hatch_InputBus(
- int id, String name, String nameRegional, int tier, int slots, String[] description) {
+ protected GT_MetaTileEntity_Hatch_InputBus(int id, String name, String nameRegional, int tier, int slots,
+ String[] description) {
super(id, name, nameRegional, tier, slots, description);
}
@@ -65,23 +69,23 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch
this(aName, aTier, getSlots(aTier) + 1, aDescription, aTextures);
}
- public GT_MetaTileEntity_Hatch_InputBus(
- String aName, int aTier, int aSlots, String[] aDescription, ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_Hatch_InputBus(String aName, int aTier, int aSlots, String[] aDescription,
+ ITexture[][][] aTextures) {
super(aName, aTier, aSlots, aDescription, aTextures);
}
@Override
public ITexture[] getTexturesActive(ITexture aBaseTexture) {
return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch
- ? new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(ITEM_IN_SIGN)}
- : new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN)};
+ ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(ITEM_IN_SIGN) }
+ : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN) };
}
@Override
public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch
- ? new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(ITEM_IN_SIGN)}
- : new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN)};
+ ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(ITEM_IN_SIGN) }
+ : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN) };
}
@Override
@@ -128,8 +132,8 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch
@Override
public void initDefaultModes(NBTTagCompound aNBT) {
if (!getBaseMetaTileEntity().getWorld().isRemote) {
- GT_ClientPreference tPreference = GT_Mod.gregtechproxy.getClientPreference(
- getBaseMetaTileEntity().getOwnerUuid());
+ GT_ClientPreference tPreference = GT_Mod.gregtechproxy
+ .getClientPreference(getBaseMetaTileEntity().getOwnerUuid());
if (tPreference != null) disableFilter = !tPreference.isInputBusInitialFilterEnabled();
}
}
@@ -216,7 +220,8 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch
} else {
disableFilter = !disableFilter;
GT_Utility.sendChatToPlayer(
- aPlayer, StatCollector.translateToLocal("GT5U.hatch.disableFilter." + disableFilter));
+ aPlayer,
+ StatCollector.translateToLocal("GT5U.hatch.disableFilter." + disableFilter));
}
}
@@ -228,8 +233,7 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch
@Override
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return aSide == getBaseMetaTileEntity().getFrontFacing()
- && aIndex != getCircuitSlot()
+ return aSide == getBaseMetaTileEntity().getFrontFacing() && aIndex != getCircuitSlot()
&& (mRecipeMap == null || disableFilter || mRecipeMap.containsInput(aStack))
&& (disableLimited || limitedAllowPutStack(aIndex, aStack));
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java
index 963aa5a0d7..bcc260fd2e 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java
@@ -7,12 +7,21 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_AUTOMAINTENANCE_IDL
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_DUCTTAPE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_MAINTENANCE;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.common.util.FakePlayer;
+
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
import com.gtnewhorizons.modularui.common.internal.wrapper.BaseSlot;
import com.gtnewhorizons.modularui.common.widget.DrawableWidget;
import com.gtnewhorizons.modularui.common.widget.SlotWidget;
import com.gtnewhorizons.modularui.common.widget.TextWidget;
+
import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.enums.ItemList;
@@ -30,23 +39,12 @@ import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
import ic2.core.IHasGui;
import ic2.core.item.ItemToolbox;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.inventory.IInventory;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraftforge.common.util.FakePlayer;
public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch implements IAddUIWidgets {
+
private static ItemStack[] sAutoMaintenanceInputs;
- public boolean mWrench = false,
- mScrewdriver = false,
- mSoftHammer = false,
- mHardHammer = false,
- mSolderingTool = false,
- mCrowbar = false,
- mAuto;
+ public boolean mWrench = false, mScrewdriver = false, mSoftHammer = false, mHardHammer = false,
+ mSolderingTool = false, mCrowbar = false, mAuto;
public GT_MetaTileEntity_Hatch_Maintenance(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier, 1, "For maintaining Multiblocks");
@@ -58,26 +56,23 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch
mAuto = aAuto;
}
- public GT_MetaTileEntity_Hatch_Maintenance(
- String aName, int aTier, String aDescription, ITexture[][][] aTextures, boolean aAuto) {
+ public GT_MetaTileEntity_Hatch_Maintenance(String aName, int aTier, String aDescription, ITexture[][][] aTextures,
+ boolean aAuto) {
super(aName, aTier, aAuto ? 4 : 1, aDescription, aTextures);
mAuto = aAuto;
}
- public GT_MetaTileEntity_Hatch_Maintenance(
- String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, boolean aAuto) {
+ public GT_MetaTileEntity_Hatch_Maintenance(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures,
+ boolean aAuto) {
super(aName, aTier, aAuto ? 4 : 1, aDescription, aTextures);
mAuto = aAuto;
}
private static ItemStack[] getAutoMaintenanceInputs() {
- if (sAutoMaintenanceInputs == null)
- sAutoMaintenanceInputs = new ItemStack[] {
- ItemList.Duct_Tape.get(4),
+ if (sAutoMaintenanceInputs == null) sAutoMaintenanceInputs = new ItemStack[] { ItemList.Duct_Tape.get(4),
GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Lubricant, 2),
GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Steel, 4),
- GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 2)
- };
+ GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 2) };
return sAutoMaintenanceInputs;
}
@@ -100,31 +95,17 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch
@Override
public ITexture[] getTexturesActive(ITexture aBaseTexture) {
- if (mAuto)
- return new ITexture[] {
- aBaseTexture,
- TextureFactory.of(OVERLAY_AUTOMAINTENANCE_IDLE),
- TextureFactory.builder()
- .addIcon(OVERLAY_AUTOMAINTENANCE_IDLE_GLOW)
- .glow()
- .build()
- };
- return new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_MAINTENANCE)};
+ if (mAuto) return new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_AUTOMAINTENANCE_IDLE),
+ TextureFactory.builder().addIcon(OVERLAY_AUTOMAINTENANCE_IDLE_GLOW).glow().build() };
+ return new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_MAINTENANCE) };
}
@Override
public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
- if (mAuto)
- return new ITexture[] {
- aBaseTexture,
- TextureFactory.of(OVERLAY_AUTOMAINTENANCE),
- TextureFactory.builder()
- .addIcon(OVERLAY_AUTOMAINTENANCE_GLOW)
- .glow()
- .build()
- };
- return new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_MAINTENANCE), TextureFactory.of(OVERLAY_DUCTTAPE)
- };
+ if (mAuto) return new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_AUTOMAINTENANCE),
+ TextureFactory.builder().addIcon(OVERLAY_AUTOMAINTENANCE_GLOW).glow().build() };
+ return new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_MAINTENANCE),
+ TextureFactory.of(OVERLAY_DUCTTAPE) };
}
@Override
@@ -160,13 +141,12 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch
}
@Override
- public boolean onRightclick(
- IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) {
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX,
+ float aY, float aZ) {
if (aBaseMetaTileEntity.isClientSide()) return true;
if (aSide == aBaseMetaTileEntity.getFrontFacing()) {
// only allow OC robot fake player
- if (aPlayer instanceof FakePlayer
- && !aPlayer.getGameProfile().getName().endsWith(".robot")) return false;
+ if (aPlayer instanceof FakePlayer && !aPlayer.getGameProfile().getName().endsWith(".robot")) return false;
ItemStack tStack = aPlayer.getCurrentEquippedItem();
if (tStack != null) {
if (tStack.getItem() instanceof ItemToolbox) {
@@ -213,9 +193,8 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch
amt = tStack.stackSize;
boolean temp = true;
for (ItemStack aStack : mInventory) {
- if ((GT_Utility.areUnificationsEqual(aStack, tStack, true)
- || GT_Utility.areUnificationsEqual(
- GT_OreDictUnificator.get(false, aStack), tStack, true))) {
+ if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility
+ .areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true))) {
amt -= aStack.stackSize;
if (amt < 1) {
temp = false;
@@ -232,9 +211,8 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch
if (tStack != null) {
amt = tStack.stackSize;
for (ItemStack aStack : mInventory) {
- if ((GT_Utility.areUnificationsEqual(aStack, tStack, true)
- || GT_Utility.areUnificationsEqual(
- GT_OreDictUnificator.get(false, aStack), tStack, true))) {
+ if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility
+ .areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true))) {
if (aStack.stackSize < amt) {
amt -= aStack.stackSize;
aStack.stackSize = 0;
@@ -267,21 +245,21 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch
return;
}
- if (GT_Utility.isStackInList(aStack, GregTech_API.sWrenchList)
- && !mWrench
- && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) mWrench = true;
- if (GT_Utility.isStackInList(aStack, GregTech_API.sScrewdriverList)
- && !mScrewdriver
- && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) mScrewdriver = true;
- if (GT_Utility.isStackInList(aStack, GregTech_API.sSoftHammerList)
- && !mSoftHammer
- && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) mSoftHammer = true;
- if (GT_Utility.isStackInList(aStack, GregTech_API.sHardHammerList)
- && !mHardHammer
- && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) mHardHammer = true;
- if (GT_Utility.isStackInList(aStack, GregTech_API.sCrowbarList)
- && !mCrowbar
- && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) mCrowbar = true;
+ if (GT_Utility.isStackInList(aStack, GregTech_API.sWrenchList) && !mWrench
+ && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer))
+ mWrench = true;
+ if (GT_Utility.isStackInList(aStack, GregTech_API.sScrewdriverList) && !mScrewdriver
+ && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer))
+ mScrewdriver = true;
+ if (GT_Utility.isStackInList(aStack, GregTech_API.sSoftHammerList) && !mSoftHammer
+ && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer))
+ mSoftHammer = true;
+ if (GT_Utility.isStackInList(aStack, GregTech_API.sHardHammerList) && !mHardHammer
+ && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer))
+ mHardHammer = true;
+ if (GT_Utility.isStackInList(aStack, GregTech_API.sCrowbarList) && !mCrowbar
+ && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer))
+ mCrowbar = true;
if (!mSolderingTool && GT_ModHandler.useSolderingIron(aStack, aPlayer, aToolboxInventory))
mSolderingTool = true;
if (GT_OreDictUnificator.isItemStackInstanceOf(aStack, "craftingDuctTape")) {
@@ -293,8 +271,7 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch
EntityPlayerMP tPlayer = (EntityPlayerMP) aPlayer;
try {
GT_Mod.achievements.issueAchievement(tPlayer, "maintainance");
- } catch (Exception ignored) {
- }
+ } catch (Exception ignored) {}
}
}
@@ -322,10 +299,10 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch
@Override
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
if (mAuto && GT_Mod.gregtechproxy.mAMHInteraction) {
- for (int i = 0; i < getSizeInventory(); i++)
- if (GT_Utility.areStacksEqual(
- GT_OreDictUnificator.get(false, aStack), GT_OreDictUnificator.get(false, getStackInSlot(i))))
- return i == aIndex;
+ for (int i = 0; i < getSizeInventory(); i++) if (GT_Utility.areStacksEqual(
+ GT_OreDictUnificator.get(false, aStack),
+ GT_OreDictUnificator.get(false, getStackInSlot(i))))
+ return i == aIndex;
for (ItemStack tInput : getAutoMaintenanceInputs())
if (GT_Utility.areUnificationsEqual(tInput, aStack, true)
|| GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tInput, true))
@@ -344,34 +321,29 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch
if (mAuto) {
getBaseMetaTileEntity().add2by2Slots(builder);
} else {
- builder.widget(new DrawableWidget()
- .setDrawable(GT_UITextures.SLOT_MAINTENANCE)
- .setPos(78, 33)
- .setSize(20, 20))
- .widget(
- new SlotWidget(BaseSlot.empty()) {
- @Override
- public boolean handleDragAndDrop(ItemStack draggedStack, int button) {
- return false;
- }
-
- @Override
- protected void phantomClick(ClickData clickData, ItemStack cursorStack) {
- if (cursorStack == null) return;
- onToolClick(cursorStack, getContext().getPlayer());
- if (cursorStack.stackSize < 1) {
- getContext().getPlayer().inventory.setItemStack(null);
- }
- if (getContext().getPlayer() instanceof EntityPlayerMP) {
- ((EntityPlayerMP) getContext().getPlayer()).updateHeldItem();
- }
- }
- }.disableShiftInsert()
- .setBackground(GT_UITextures.TRANSPARENT)
- .setPos(79, 34))
- .widget(new TextWidget("Click with Tool to repair.")
- .setDefaultColor(COLOR_TEXT_GRAY.get())
- .setPos(8, 12));
+ builder.widget(
+ new DrawableWidget().setDrawable(GT_UITextures.SLOT_MAINTENANCE).setPos(78, 33).setSize(20, 20))
+ .widget(new SlotWidget(BaseSlot.empty()) {
+
+ @Override
+ public boolean handleDragAndDrop(ItemStack draggedStack, int button) {
+ return false;
+ }
+
+ @Override
+ protected void phantomClick(ClickData clickData, ItemStack cursorStack) {
+ if (cursorStack == null) return;
+ onToolClick(cursorStack, getContext().getPlayer());
+ if (cursorStack.stackSize < 1) {
+ getContext().getPlayer().inventory.setItemStack(null);
+ }
+ if (getContext().getPlayer() instanceof EntityPlayerMP) {
+ ((EntityPlayerMP) getContext().getPlayer()).updateHeldItem();
+ }
+ }
+ }.disableShiftInsert().setBackground(GT_UITextures.TRANSPARENT).setPos(79, 34)).widget(
+ new TextWidget("Click with Tool to repair.").setDefaultColor(COLOR_TEXT_GRAY.get())
+ .setPos(8, 12));
}
}
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java
index 3e1b39c1fd..b41f45e6d2 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java
@@ -3,6 +3,13 @@ package gregtech.api.metatileentity.implementations;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_MUFFLER;
import static gregtech.api.objects.XSTR.XSTR_INSTANCE;
+import java.util.Arrays;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.GT_Mod;
@@ -15,14 +22,10 @@ import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.WorldSpawnedEventBuilder;
import gregtech.common.GT_Pollution;
import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_Cleanroom;
-import java.util.Arrays;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.world.World;
-import net.minecraftforge.common.util.ForgeDirection;
@SuppressWarnings("unused") // Unused API is expected within scope
public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch {
+
private static final String localizedDescFormat = GT_LanguageManager.addStringLocalization(
"gt.blockmachines.hatch.muffler.desc.format",
"Outputs the Pollution (Might cause ... things)%n" + "DO NOT OBSTRUCT THE OUTPUT!%n"
@@ -38,27 +41,21 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch {
super(aID, aName, aNameRegional, aTier, 0, "");
}
- public GT_MetaTileEntity_Hatch_Muffler(
- int aID,
- String aName,
- String aNameRegional,
- int aTier,
- int aInvSlotCount,
- String[] aDescription,
- ITexture... aTextures) {
+ public GT_MetaTileEntity_Hatch_Muffler(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount,
+ String[] aDescription, ITexture... aTextures) {
super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures);
}
public GT_MetaTileEntity_Hatch_Muffler(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
- this(aName, aTier, new String[] {aDescription}, aTextures);
+ this(aName, aTier, new String[] { aDescription }, aTextures);
}
public GT_MetaTileEntity_Hatch_Muffler(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
this(aName, aTier, 0, aDescription, aTextures);
}
- public GT_MetaTileEntity_Hatch_Muffler(
- String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_Hatch_Muffler(String aName, int aTier, int aInvSlotCount, String[] aDescription,
+ ITexture[][][] aTextures) {
super(aName, aTier, aInvSlotCount, aDescription, aTextures);
setInValidFacings(ForgeDirection.DOWN);
}
@@ -70,12 +67,12 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch {
@Override
public ITexture[] getTexturesActive(ITexture aBaseTexture) {
- return new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_MUFFLER)};
+ return new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_MUFFLER) };
}
@Override
public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
- return new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_MUFFLER)};
+ return new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_MUFFLER) };
}
@Override
@@ -163,30 +160,25 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch {
}
WorldSpawnedEventBuilder.ParticleEventBuilder events = new WorldSpawnedEventBuilder.ParticleEventBuilder()
- .setIdentifier(name)
- .setWorld(aWorld)
- .setMotion(xSpd, ySpd, zSpd);
+ .setIdentifier(name).setWorld(aWorld).setMotion(xSpd, ySpd, zSpd);
if (chk1) {
events.setPosition(
- xPos + ran1 * 0.5F,
- yPos + XSTR_INSTANCE.nextFloat() * 0.5F,
- zPos + XSTR_INSTANCE.nextFloat() * 0.5F)
- .run();
+ xPos + ran1 * 0.5F,
+ yPos + XSTR_INSTANCE.nextFloat() * 0.5F,
+ zPos + XSTR_INSTANCE.nextFloat() * 0.5F).run();
}
if (chk2) {
events.setPosition(
- xPos + ran2 * 0.5F,
- yPos + XSTR_INSTANCE.nextFloat() * 0.5F,
- zPos + XSTR_INSTANCE.nextFloat() * 0.5F)
- .run();
+ xPos + ran2 * 0.5F,
+ yPos + XSTR_INSTANCE.nextFloat() * 0.5F,
+ zPos + XSTR_INSTANCE.nextFloat() * 0.5F).run();
}
if (chk3) {
events.setPosition(
- xPos + ran3 * 0.5F,
- yPos + XSTR_INSTANCE.nextFloat() * 0.5F,
- zPos + XSTR_INSTANCE.nextFloat() * 0.5F)
- .run();
+ xPos + ran3 * 0.5F,
+ yPos + XSTR_INSTANCE.nextFloat() * 0.5F,
+ zPos + XSTR_INSTANCE.nextFloat() * 0.5F).run();
}
}
@@ -207,8 +199,8 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch {
}
/**
- * @param mte The multi-block controller's {@link MetaTileEntity}
- * MetaTileEntity is passed so newer muffler hatches can do wacky things with the multis
+ * @param mte The multi-block controller's {@link MetaTileEntity} MetaTileEntity is passed so newer muffler hatches
+ * can do wacky things with the multis
* @return pollution success
*/
public boolean polluteEnvironment(MetaTileEntity mte) {
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_MultiInput.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_MultiInput.java
index 66c5401bd7..7d95e0b17c 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_MultiInput.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_MultiInput.java
@@ -2,11 +2,18 @@ package gregtech.api.metatileentity.implementations;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_INPUT_HATCH_2x2;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+
import com.gtnewhorizons.modularui.api.ModularUITextures;
import com.gtnewhorizons.modularui.api.math.Pos2d;
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
import com.gtnewhorizons.modularui.common.internal.network.NetworkUtils;
+
import gregtech.api.enums.ItemList;
import gregtech.api.interfaces.IFluidAccess;
import gregtech.api.interfaces.ITexture;
@@ -16,11 +23,6 @@ import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Utility;
import gregtech.common.gui.modularui.widget.FluidDisplaySlotWidget;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.fluids.FluidTankInfo;
public class GT_MetaTileEntity_Hatch_MultiInput extends GT_MetaTileEntity_Hatch_Input implements IAddUIWidgets {
@@ -33,8 +35,8 @@ public class GT_MetaTileEntity_Hatch_MultiInput extends GT_MetaTileEntity_Hatch_
mCapacityPer = 8000 * (1 << aTier) / aSlot;
}
- public GT_MetaTileEntity_Hatch_MultiInput(
- String aName, int aSlot, int aTier, String[] aDescription, ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_Hatch_MultiInput(String aName, int aSlot, int aTier, String[] aDescription,
+ ITexture[][][] aTextures) {
super(aName, aSlot, aTier, aDescription, aTextures);
this.mStoredFluid = new FluidStack[aSlot];
mCapacityPer = 8000 * (1 << aTier) / aSlot;
@@ -79,12 +81,12 @@ public class GT_MetaTileEntity_Hatch_MultiInput extends GT_MetaTileEntity_Hatch_
@Override
public ITexture[] getTexturesActive(ITexture aBaseTexture) {
- return new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_INPUT_HATCH_2x2)};
+ return new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_INPUT_HATCH_2x2) };
}
@Override
public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
- return new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_INPUT_HATCH_2x2)};
+ return new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_INPUT_HATCH_2x2) };
}
public int getMaxType() {
@@ -169,11 +171,11 @@ public class GT_MetaTileEntity_Hatch_MultiInput extends GT_MetaTileEntity_Hatch_
@Override
public int fill(FluidStack aFluid, boolean doFill) {
- if (aFluid == null
- || aFluid.getFluid().getID() <= 0
+ if (aFluid == null || aFluid.getFluid().getID() <= 0
|| aFluid.amount <= 0
|| !canTankBeFilled()
- || !isFluidInputAllowed(aFluid)) return 0;
+ || !isFluidInputAllowed(aFluid))
+ return 0;
if (!hasFluid(aFluid) && getFirstEmptySlot() != -1) {
int tFilled = Math.min(aFluid.amount, mCapacityPer);
if (doFill) {
@@ -295,34 +297,28 @@ public class GT_MetaTileEntity_Hatch_MultiInput extends GT_MetaTileEntity_Hatch_
@Override
public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) {
final int SLOT_NUMBER = 4;
- final Pos2d[] positions = new Pos2d[] {
- new Pos2d(70, 25), new Pos2d(88, 25), new Pos2d(70, 43), new Pos2d(88, 43),
- };
+ final Pos2d[] positions = new Pos2d[] { new Pos2d(70, 25), new Pos2d(88, 25), new Pos2d(70, 43),
+ new Pos2d(88, 43), };
for (int i = 0; i < SLOT_NUMBER; i++) {
final int slotId = i;
- builder.widget(new FluidDisplaySlotWidget(inventoryHandler, slotId)
- .setFluidAccessConstructor(() -> constructFluidAccess(slotId))
- .setIHasFluidDisplay(this)
- .setCanDrain(true)
- .setCanFill(!isDrainableStackSeparate())
- .setActionRealClick(FluidDisplaySlotWidget.Action.TRANSFER)
- .setBeforeRealClick((clickData, widget) -> {
- if (NetworkUtils.isClient()) {
- // propagate display item content to actual fluid stored in this tank
- setFluid(
- GT_Utility.getFluidFromDisplayStack(
- widget.getMcSlot().getStack()),
- slotId);
- }
- ItemStack tStackHeld =
- widget.getContext().getPlayer().inventory.getItemStack();
- FluidStack tFluidHeld = GT_Utility.getFluidForFilledItem(tStackHeld, true);
- return constructFluidAccess(slotId).isMatch(tFluidHeld, slotId);
- })
- .setUpdateFluidDisplayItem(() -> updateFluidDisplayItem(slotId))
- .setBackground(ModularUITextures.FLUID_SLOT)
- .setPos(positions[slotId]));
+ builder.widget(
+ new FluidDisplaySlotWidget(inventoryHandler, slotId)
+ .setFluidAccessConstructor(() -> constructFluidAccess(slotId)).setIHasFluidDisplay(this)
+ .setCanDrain(true).setCanFill(!isDrainableStackSeparate())
+ .setActionRealClick(FluidDisplaySlotWidget.Action.TRANSFER)
+ .setBeforeRealClick((clickData, widget) -> {
+ if (NetworkUtils.isClient()) {
+ // propagate display item content to actual fluid stored in this tank
+ setFluid(
+ GT_Utility.getFluidFromDisplayStack(widget.getMcSlot().getStack()),
+ slotId);
+ }
+ ItemStack tStackHeld = widget.getContext().getPlayer().inventory.getItemStack();
+ FluidStack tFluidHeld = GT_Utility.getFluidForFilledItem(tStackHeld, true);
+ return constructFluidAccess(slotId).isMatch(tFluidHeld, slotId);
+ }).setUpdateFluidDisplayItem(() -> updateFluidDisplayItem(slotId))
+ .setBackground(ModularUITextures.FLUID_SLOT).setPos(positions[slotId]));
}
}
@@ -331,6 +327,7 @@ public class GT_MetaTileEntity_Hatch_MultiInput extends GT_MetaTileEntity_Hatch_
}
protected static class MultiFluidAccess implements IFluidAccess {
+
private final GT_MetaTileEntity_Hatch_MultiInput mTank;
private final int mSlot;
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java
index 2809ab3815..ed29f8fe08 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java
@@ -3,6 +3,16 @@ package gregtech.api.metatileentity.implementations;
import static gregtech.api.enums.Textures.BlockIcons.FLUID_OUT_SIGN;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_OUT;
+import java.lang.ref.WeakReference;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.StatCollector;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.*;
+
import com.gtnewhorizons.modularui.api.math.Alignment;
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
@@ -10,6 +20,7 @@ import com.gtnewhorizons.modularui.common.internal.network.NetworkUtils;
import com.gtnewhorizons.modularui.common.widget.DrawableWidget;
import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget;
import com.gtnewhorizons.modularui.common.widget.TextWidget;
+
import gregtech.GT_Mod;
import gregtech.api.gui.modularui.GT_UIInfos;
import gregtech.api.gui.modularui.GT_UITextures;
@@ -22,28 +33,25 @@ import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Utility;
import gregtech.common.gui.modularui.widget.FluidDisplaySlotWidget;
-import java.lang.ref.WeakReference;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.util.StatCollector;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.*;
public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch implements IFluidLockable, IAddUIWidgets {
+
private String lockedFluidName = null;
private WeakReference<EntityPlayer> playerThatLockedfluid = null;
public byte mMode = 0;
public GT_MetaTileEntity_Hatch_Output(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 4, new String[] {
- "Fluid Output for Multiblocks",
- "Capacity: " + GT_Utility.formatNumbers(8000 * (1 << aTier)) + "L",
- "Right click with screwdriver to restrict output",
- "Can be restricted to put out Items and/or Steam/No Steam/1 specific Fluid",
- "Restricted Output Hatches are given priority for Multiblock Fluid output"
- });
+ super(
+ aID,
+ aName,
+ aNameRegional,
+ aTier,
+ 4,
+ new String[] { "Fluid Output for Multiblocks",
+ "Capacity: " + GT_Utility.formatNumbers(8000 * (1 << aTier)) + "L",
+ "Right click with screwdriver to restrict output",
+ "Can be restricted to put out Items and/or Steam/No Steam/1 specific Fluid",
+ "Restricted Output Hatches are given priority for Multiblock Fluid output" });
}
public GT_MetaTileEntity_Hatch_Output(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
@@ -54,28 +62,30 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl
super(aName, aTier, 4, aDescription, aTextures);
}
- public GT_MetaTileEntity_Hatch_Output(
- int aID, String aName, String aNameRegional, int aTier, String[] aDescription, int inventorySize) {
+ public GT_MetaTileEntity_Hatch_Output(int aID, String aName, String aNameRegional, int aTier, String[] aDescription,
+ int inventorySize) {
super(aID, aName, aNameRegional, aTier, inventorySize, aDescription);
}
- public GT_MetaTileEntity_Hatch_Output(
- String name, int tier, int slots, String[] description, ITexture[][][] textures) {
+ public GT_MetaTileEntity_Hatch_Output(String name, int tier, int slots, String[] description,
+ ITexture[][][] textures) {
super(name, tier, slots, description, textures);
}
@Override
public ITexture[] getTexturesActive(ITexture aBaseTexture) {
return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch
- ? new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(FLUID_OUT_SIGN)}
- : new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT)};
+ ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT),
+ TextureFactory.of(FLUID_OUT_SIGN) }
+ : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT) };
}
@Override
public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch
- ? new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(FLUID_OUT_SIGN)}
- : new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT)};
+ ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT),
+ TextureFactory.of(FLUID_OUT_SIGN) }
+ : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT) };
}
@Override
@@ -113,16 +123,16 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
super.onPostTick(aBaseMetaTileEntity, aTick);
if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && mFluid != null) {
- IFluidHandler tTileEntity =
- aBaseMetaTileEntity.getITankContainerAtSide(aBaseMetaTileEntity.getFrontFacing());
+ IFluidHandler tTileEntity = aBaseMetaTileEntity
+ .getITankContainerAtSide(aBaseMetaTileEntity.getFrontFacing());
if (tTileEntity != null) {
FluidStack tDrained = aBaseMetaTileEntity.drain(
ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing()),
Math.max(1, mFluid.amount),
false);
if (tDrained != null) {
- int tFilledAmount = tTileEntity.fill(
- ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), tDrained, false);
+ int tFilledAmount = tTileEntity
+ .fill(ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), tDrained, false);
if (tFilledAmount > 0) {
tTileEntity.fill(
ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()),
@@ -153,8 +163,7 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl
lockedFluidName = aNBT.getString("lockedFluidName");
lockedFluidName = lockedFluidName.length() == 0 ? null : lockedFluidName;
if (GT_Utility.getFluidFromUnlocalizedName(lockedFluidName) != null) {
- lockedFluidName =
- GT_Utility.getFluidFromUnlocalizedName(lockedFluidName).getName();
+ lockedFluidName = GT_Utility.getFluidFromUnlocalizedName(lockedFluidName).getName();
}
}
@@ -285,7 +294,8 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl
aPlayer,
String.format(
"%s (%s)",
- GT_Utility.trans("151.1", "Outputs items and 1 specific Fluid"), inBrackets));
+ GT_Utility.trans("151.1", "Outputs items and 1 specific Fluid"),
+ inBrackets));
break;
case 9:
playerThatLockedfluid = new WeakReference<>(aPlayer);
@@ -314,8 +324,7 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl
if (tFluid == null && tCurrentItem.getItem() instanceof IFluidContainerItem)
tFluid = ((IFluidContainerItem) tCurrentItem.getItem()).getFluid(tCurrentItem);
if (tFluid != null) {
- if (getLockedFluidName() != null
- && !getLockedFluidName().equals(tFluid.getFluid().getName())) {
+ if (getLockedFluidName() != null && !getLockedFluidName().equals(tFluid.getFluid().getName())) {
GT_Utility.sendChatToPlayer(
aPlayer,
String.format(
@@ -326,19 +335,18 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl
StatCollector.translateToLocal(getLockedFluidName())));
} else {
setLockedFluidName(tFluid.getFluid().getName());
- if (mMode == 8)
- GT_Utility.sendChatToPlayer(
- aPlayer,
- String.format(
- "%s (%s)",
- GT_Utility.trans("151.1", "Outputs items and 1 specific Fluid"),
- tFluid.getLocalizedName()));
- else
- GT_Utility.sendChatToPlayer(
- aPlayer,
- String.format(
- "%s (%s)",
- GT_Utility.trans("151.2", "Outputs 1 specific Fluid"), tFluid.getLocalizedName()));
+ if (mMode == 8) GT_Utility.sendChatToPlayer(
+ aPlayer,
+ String.format(
+ "%s (%s)",
+ GT_Utility.trans("151.1", "Outputs items and 1 specific Fluid"),
+ tFluid.getLocalizedName()));
+ else GT_Utility.sendChatToPlayer(
+ aPlayer,
+ String.format(
+ "%s (%s)",
+ GT_Utility.trans("151.2", "Outputs 1 specific Fluid"),
+ tFluid.getLocalizedName()));
}
return true;
}
@@ -350,8 +358,8 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl
}
@Override
- public boolean onRightclick(
- IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) {
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX,
+ float aY, float aZ) {
if (tryToLockHatch(aPlayer, aSide)) return true;
return super.onRightclick(aBaseMetaTileEntity, aPlayer, aSide, aX, aY, aZ);
}
@@ -425,7 +433,8 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl
GT_Utility.sendChatToPlayer(
player,
String.format(
- GT_Utility.trans("151.4", "Successfully locked Fluid to %s"), mFluid.getLocalizedName()));
+ GT_Utility.trans("151.4", "Successfully locked Fluid to %s"),
+ mFluid.getLocalizedName()));
playerThatLockedfluid = null;
}
}
@@ -437,21 +446,20 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl
@Override
public String[] getInfoData() {
- return new String[] {
- EnumChatFormatting.BLUE + "Output Hatch" + EnumChatFormatting.RESET,
- "Stored Fluid:",
- EnumChatFormatting.GOLD
- + (mFluid == null ? "No Fluid" : mFluid.getLocalizedName())
- + EnumChatFormatting.RESET,
- EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mFluid == null ? 0 : mFluid.amount) + " L"
- + EnumChatFormatting.RESET + " " + EnumChatFormatting.YELLOW
- + GT_Utility.formatNumbers(getCapacity()) + " L" + EnumChatFormatting.RESET,
- (!isFluidLocked() || lockedFluidName == null)
- ? "Not Locked"
- : ("Locked to "
- + StatCollector.translateToLocal(FluidRegistry.getFluidStack(lockedFluidName, 1)
- .getUnlocalizedName()))
- };
+ return new String[] { EnumChatFormatting.BLUE + "Output Hatch" + EnumChatFormatting.RESET, "Stored Fluid:",
+ EnumChatFormatting.GOLD + (mFluid == null ? "No Fluid" : mFluid.getLocalizedName())
+ + EnumChatFormatting.RESET,
+ EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mFluid == null ? 0 : mFluid.amount)
+ + " L"
+ + EnumChatFormatting.RESET
+ + " "
+ + EnumChatFormatting.YELLOW
+ + GT_Utility.formatNumbers(getCapacity())
+ + " L"
+ + EnumChatFormatting.RESET,
+ (!isFluidLocked() || lockedFluidName == null) ? "Not Locked"
+ : ("Locked to " + StatCollector.translateToLocal(
+ FluidRegistry.getFluidStack(lockedFluidName, 1).getUnlocalizedName())) };
}
@Override
@@ -462,36 +470,26 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl
@Override
public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) {
super.addUIWidgets(builder, buildContext);
- builder.widget(new DrawableWidget()
- .setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK)
- .setPos(98, 16)
- .setSize(71, 45))
- .widget(new FluidDisplaySlotWidget(inventoryHandler, getLockedDisplaySlot())
- .setIHasFluidDisplay(this)
- .setActionRealClick(FluidDisplaySlotWidget.Action.LOCK)
- .setActionDragAndDrop(FluidDisplaySlotWidget.Action.LOCK)
- .setBeforeClick((clickData, widget) -> {
- if (NetworkUtils.isClient()) {
- // propagate display item content to actual fluid stored in this tank
- setDrainableStack(
- GT_Utility.getFluidFromDisplayStack(mInventory[getStackDisplaySlot()]));
- }
- return true;
- })
- .setBackground(GT_UITextures.TRANSPARENT)
- .setPos(149, 41))
- .widget(new TextWidget("Locked Fluid")
- .setDefaultColor(COLOR_TEXT_WHITE.get())
- .setPos(101, 20))
+ builder.widget(
+ new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK).setPos(98, 16).setSize(71, 45))
+ .widget(
+ new FluidDisplaySlotWidget(inventoryHandler, getLockedDisplaySlot()).setIHasFluidDisplay(this)
+ .setActionRealClick(FluidDisplaySlotWidget.Action.LOCK)
+ .setActionDragAndDrop(FluidDisplaySlotWidget.Action.LOCK)
+ .setBeforeClick((clickData, widget) -> {
+ if (NetworkUtils.isClient()) {
+ // propagate display item content to actual fluid stored in this tank
+ setDrainableStack(
+ GT_Utility.getFluidFromDisplayStack(mInventory[getStackDisplaySlot()]));
+ }
+ return true;
+ }).setBackground(GT_UITextures.TRANSPARENT).setPos(149, 41))
+ .widget(new TextWidget("Locked Fluid").setDefaultColor(COLOR_TEXT_WHITE.get()).setPos(101, 20))
.widget(TextWidget.dynamicString(() -> {
- final ItemStack lockedDisplayStack = mInventory[getLockedDisplaySlot()];
- return lockedDisplayStack == null ? "None" : lockedDisplayStack.getDisplayName();
- })
- .setSynced(false)
- .setDefaultColor(COLOR_TEXT_WHITE.get())
- .setTextAlignment(Alignment.CenterLeft)
- .setMaxWidth(65)
- .setPos(101, 30))
+ final ItemStack lockedDisplayStack = mInventory[getLockedDisplaySlot()];
+ return lockedDisplayStack == null ? "None" : lockedDisplayStack.getDisplayName();
+ }).setSynced(false).setDefaultColor(COLOR_TEXT_WHITE.get()).setTextAlignment(Alignment.CenterLeft)
+ .setMaxWidth(65).setPos(101, 30))
// #updateFluidDisplayItem invalidates locked fluid slot
// if lockedFluidName == null or mMode is incorrect
.widget(new FakeSyncWidget.StringSyncer(() -> lockedFluidName, val -> lockedFluidName = val))
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 ad1c799708..094ad29471 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
@@ -4,8 +4,13 @@ import static gregtech.api.enums.Textures.BlockIcons.ITEM_OUT_SIGN;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_OUT;
import static gregtech.api.util.GT_Utility.moveMultipleItemStacks;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
+
import gregtech.GT_Mod;
import gregtech.api.gui.modularui.GT_UIInfos;
import gregtech.api.interfaces.ITexture;
@@ -15,11 +20,9 @@ import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Utility;
import gregtech.api.util.extensions.ArrayExt;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.inventory.IInventory;
-import net.minecraft.item.ItemStack;
public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch implements IAddUIWidgets {
+
public GT_MetaTileEntity_Hatch_OutputBus(int aID, String aName, String aNameRegional, int aTier) {
this(aID, aName, aNameRegional, aTier, getSlots(aTier));
}
@@ -36,13 +39,13 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch i
"Capacity: " + getSlots(tier) + " stack" + (getSlots(tier) >= 2 ? "s" : "")));
}
- public GT_MetaTileEntity_Hatch_OutputBus(
- int aID, String aName, String aNameRegional, int aTier, String[] aDescription) {
+ public GT_MetaTileEntity_Hatch_OutputBus(int aID, String aName, String aNameRegional, int aTier,
+ String[] aDescription) {
super(aID, aName, aNameRegional, aTier, getSlots(aTier), aDescription);
}
- public GT_MetaTileEntity_Hatch_OutputBus(
- int aID, String aName, String aNameRegional, int aTier, String[] aDescription, int inventorySize) {
+ public GT_MetaTileEntity_Hatch_OutputBus(int aID, String aName, String aNameRegional, int aTier,
+ String[] aDescription, int inventorySize) {
super(aID, aName, aNameRegional, aTier, inventorySize, aDescription);
}
@@ -57,23 +60,23 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch i
super(aName, aTier, getSlots(aTier), aDescription, aTextures);
}
- public GT_MetaTileEntity_Hatch_OutputBus(
- String name, int tier, int slots, String[] description, ITexture[][][] textures) {
+ public GT_MetaTileEntity_Hatch_OutputBus(String name, int tier, int slots, String[] description,
+ ITexture[][][] textures) {
super(name, tier, slots, description, textures);
}
@Override
public ITexture[] getTexturesActive(ITexture aBaseTexture) {
return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch
- ? new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(ITEM_OUT_SIGN)}
- : new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT)};
+ ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(ITEM_OUT_SIGN) }
+ : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT) };
}
@Override
public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch
- ? new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(ITEM_OUT_SIGN)}
- : new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT)};
+ ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(ITEM_OUT_SIGN) }
+ : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT) };
}
@Override
@@ -108,11 +111,11 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch i
}
/**
- * Attempt to store as many items as possible into the internal inventory of this output bus.
- * If you need atomicity you should use {@link gregtech.api.interfaces.tileentity.IHasInventory#addStackToSlot(int, ItemStack)}
- * @param aStack Assume valid.
- * Will be mutated.
- * Take over the ownership. Caller should not retain a reference to this stack if the call returns true.
+ * Attempt to store as many items as possible into the internal inventory of this output bus. If you need atomicity
+ * you should use {@link gregtech.api.interfaces.tileentity.IHasInventory#addStackToSlot(int, ItemStack)}
+ *
+ * @param aStack Assume valid. Will be mutated. Take over the ownership. Caller should not retain a reference to
+ * this stack if the call returns true.
* @return true if stack is fully accepted. false is stack is partially accepted or nothing is accepted
*/
public boolean storeAll(ItemStack aStack) {
@@ -127,8 +130,7 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch i
mInventory[i] = aStack.splitStack(getInventoryStackLimit());
} else {
int tRealStackLimit = Math.min(getInventoryStackLimit(), tSlot.getMaxStackSize());
- if (tSlot.stackSize < tRealStackLimit
- && tSlot.isItemEqual(aStack)
+ if (tSlot.stackSize < tRealStackLimit && tSlot.isItemEqual(aStack)
&& ItemStack.areItemStackTagsEqual(tSlot, aStack)) {
if (aStack.stackSize + tSlot.stackSize <= tRealStackLimit) {
mInventory[i].stackSize += aStack.stackSize;
@@ -158,8 +160,8 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch i
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
super.onPostTick(aBaseMetaTileEntity, aTick);
if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && (aTick & 0x7) == 0) {
- final IInventory tTileEntity =
- aBaseMetaTileEntity.getIInventoryAtSide(aBaseMetaTileEntity.getFrontFacing());
+ final IInventory tTileEntity = aBaseMetaTileEntity
+ .getIInventoryAtSide(aBaseMetaTileEntity.getFrontFacing());
if (tTileEntity != null) {
moveMultipleItemStacks(
aBaseMetaTileEntity,
@@ -175,9 +177,9 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch i
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 *
+ // 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/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
index ae08a5eb02..e6ea51c59d 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
@@ -5,6 +5,25 @@ 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 java.util.ArrayList;
+import java.util.List;
+
+import mcp.mobius.waila.api.IWailaConfigHandler;
+import mcp.mobius.waila.api.IWailaDataAccessor;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+
+import org.lwjgl.input.Keyboard;
+
import com.google.common.collect.Iterables;
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
@@ -13,6 +32,7 @@ import com.gtnewhorizons.modularui.common.widget.DynamicPositionedColumn;
import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget;
import com.gtnewhorizons.modularui.common.widget.SlotWidget;
import com.gtnewhorizons.modularui.common.widget.TextWidget;
+
import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.enums.ConfigCategories;
@@ -31,43 +51,16 @@ import gregtech.common.GT_Pollution;
import gregtech.common.items.GT_MetaGenerated_Tool_01;
import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_DrillerBase;
import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_LargeTurbine;
-import java.util.ArrayList;
-import java.util.List;
-import mcp.mobius.waila.api.IWailaConfigHandler;
-import mcp.mobius.waila.api.IWailaDataAccessor;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.util.StatCollector;
-import net.minecraft.world.World;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.FluidStack;
-import org.lwjgl.input.Keyboard;
public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
implements IAddGregtechLogo, IAddUIWidgets {
public static boolean disableMaintenance;
- public boolean mMachine = false,
- mWrench = false,
- mScrewdriver = false,
- mSoftHammer = false,
- mHardHammer = false,
- mSolderingTool = false,
- mCrowbar = false,
- mRunningOnLoad = false;
+ public boolean mMachine = false, mWrench = false, mScrewdriver = false, mSoftHammer = false, mHardHammer = false,
+ mSolderingTool = false, mCrowbar = false, mRunningOnLoad = false;
public boolean mStructureChanged = false;
- public int mPollution = 0,
- mProgresstime = 0,
- mMaxProgresstime = 0,
- mEUt = 0,
- mEfficiencyIncrease = 0,
- mStartUpCheck = 100,
- mRuntime = 0,
- mEfficiency = 0;
+ public int mPollution = 0, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mEfficiencyIncrease = 0,
+ mStartUpCheck = 100, mRuntime = 0, mEfficiency = 0;
public volatile boolean mUpdated = false;
public int mUpdate = 0;
public ItemStack[] mOutputItems = null;
@@ -91,23 +84,23 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
public GT_MetaTileEntity_MultiBlockBase(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional, 2);
- GT_MetaTileEntity_MultiBlockBase.disableMaintenance = GregTech_API.sMachineFile.get(
- ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false);
- this.damageFactorLow =
- GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "MultiBlockMachines.damageFactorLow", 5);
- this.damageFactorHigh = (float) GregTech_API.sMachineFile.get(
- ConfigCategories.machineconfig, "MultiBlockMachines.damageFactorHigh", 0.6f);
+ GT_MetaTileEntity_MultiBlockBase.disableMaintenance = GregTech_API.sMachineFile
+ .get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false);
+ this.damageFactorLow = GregTech_API.sMachineFile
+ .get(ConfigCategories.machineconfig, "MultiBlockMachines.damageFactorLow", 5);
+ this.damageFactorHigh = (float) GregTech_API.sMachineFile
+ .get(ConfigCategories.machineconfig, "MultiBlockMachines.damageFactorHigh", 0.6f);
this.mNEI = "";
}
public GT_MetaTileEntity_MultiBlockBase(String aName) {
super(aName, 2);
- GT_MetaTileEntity_MultiBlockBase.disableMaintenance = GregTech_API.sMachineFile.get(
- ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false);
- this.damageFactorLow =
- GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "MultiBlockMachines.damageFactorLow", 5);
- this.damageFactorHigh = (float) GregTech_API.sMachineFile.get(
- ConfigCategories.machineconfig, "MultiBlockMachines.damageFactorHigh", 0.6f);
+ GT_MetaTileEntity_MultiBlockBase.disableMaintenance = GregTech_API.sMachineFile
+ .get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false);
+ this.damageFactorLow = GregTech_API.sMachineFile
+ .get(ConfigCategories.machineconfig, "MultiBlockMachines.damageFactorLow", 5);
+ this.damageFactorHigh = (float) GregTech_API.sMachineFile
+ .get(ConfigCategories.machineconfig, "MultiBlockMachines.damageFactorHigh", 0.6f);
}
public static boolean isValidMetaTileEntity(MetaTileEntity aMetaTileEntity) {
@@ -137,7 +130,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
mLockedToSingleRecipe = !mLockedToSingleRecipe;
if (mLockedToSingleRecipe) {
GT_Utility.sendChatToPlayer(
- aPlayer, GT_Utility.trans("223", "Single recipe locking enabled. Will lock to next recipe."));
+ aPlayer,
+ GT_Utility.trans("223", "Single recipe locking enabled. Will lock to next recipe."));
} else {
GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("220", "Single recipe locking disabled."));
mSingleRecipeCheck = null;
@@ -193,19 +187,17 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
if (mOutputItems != null) {
aNBT.setInteger("mOutputItemsLength", mOutputItems.length);
- for (int i = 0; i < mOutputItems.length; i++)
- if (mOutputItems[i] != null) {
- GT_Utility.saveItem(aNBT, "mOutputItem" + i, mOutputItems[i]);
- }
+ for (int i = 0; i < mOutputItems.length; i++) if (mOutputItems[i] != null) {
+ GT_Utility.saveItem(aNBT, "mOutputItem" + i, mOutputItems[i]);
+ }
}
if (mOutputFluids != null) {
aNBT.setInteger("mOutputFluidsLength", mOutputFluids.length);
- for (int i = 0; i < mOutputFluids.length; i++)
- if (mOutputFluids[i] != null) {
- NBTTagCompound tNBT = new NBTTagCompound();
- mOutputFluids[i].writeToNBT(tNBT);
- aNBT.setTag("mOutputFluids" + i, tNBT);
- }
+ for (int i = 0; i < mOutputFluids.length; i++) if (mOutputFluids[i] != null) {
+ NBTTagCompound tNBT = new NBTTagCompound();
+ mOutputFluids[i].writeToNBT(tNBT);
+ aNBT.setTag("mOutputFluids" + i, tNBT);
+ }
}
aNBT.setBoolean("mWrench", mWrench);
aNBT.setBoolean("mScrewdriver", mScrewdriver);
@@ -273,8 +265,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
}
/**
- * ClearHatches as a part of structure check.
- * If your multiblock has any hatches that need clearing override this method, call super, and clear your own hatches
+ * ClearHatches as a part of structure check. If your multiblock has any hatches that need clearing override this
+ * method, call super, and clear your own hatches
*/
public void clearHatches() {
mInputHatches.clear();
@@ -327,14 +319,14 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
stopMachine();
}
}
- aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127)
- | (mWrench ? 0 : 1)
- | (mScrewdriver ? 0 : 2)
- | (mSoftHammer ? 0 : 4)
- | (mHardHammer ? 0 : 8)
- | (mSolderingTool ? 0 : 16)
- | (mCrowbar ? 0 : 32)
- | (mMachine ? 0 : 64));
+ aBaseMetaTileEntity.setErrorDisplayID(
+ (aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (mWrench ? 0 : 1)
+ | (mScrewdriver ? 0 : 2)
+ | (mSoftHammer ? 0 : 4)
+ | (mHardHammer ? 0 : 8)
+ | (mSolderingTool ? 0 : 16)
+ | (mCrowbar ? 0 : 32)
+ | (mMachine ? 0 : 64));
aBaseMetaTileEntity.setActive(mMaxProgresstime > 0);
boolean active = aBaseMetaTileEntity.isActive() && mPollution > 0;
setMufflers(active);
@@ -389,19 +381,15 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
stopMachine();
}
if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime) {
- if (mOutputItems != null)
- for (ItemStack tStack : mOutputItems)
- if (tStack != null) {
- try {
- GT_Mod.achievements.issueAchivementHatch(
- aBaseMetaTileEntity
- .getWorld()
- .getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()),
- tStack);
- } catch (Exception ignored) {
- }
- addOutput(tStack);
- }
+ if (mOutputItems != null) for (ItemStack tStack : mOutputItems) if (tStack != null) {
+ try {
+ GT_Mod.achievements.issueAchivementHatch(
+ aBaseMetaTileEntity.getWorld()
+ .getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()),
+ tStack);
+ } catch (Exception ignored) {}
+ addOutput(tStack);
+ }
if (mOutputFluids != null) {
addFluidOutputs(mOutputFluids);
}
@@ -421,19 +409,16 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
if (mOutputFluids.length > 1) {
try {
GT_Mod.achievements.issueAchievement(
- aBaseMetaTileEntity
- .getWorld()
+ aBaseMetaTileEntity.getWorld()
.getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()),
"oilplant");
- } catch (Exception ignored) {
- }
+ } catch (Exception ignored) {}
}
}
}
}
} else {
- if (aTick % 100 == 0
- || aBaseMetaTileEntity.hasWorkJustBeenEnabled()
+ if (aTick % 100 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled()
|| aBaseMetaTileEntity.hasInventoryBeenModified()) {
if (aBaseMetaTileEntity.isAllowedToWork()) {
@@ -511,8 +496,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
}
/**
- * Gets the pollution produced per second by this multiblock, default to 0. Override this with
- * its actual value in the code of the multiblock.
+ * Gets the pollution produced per second by this multiblock, default to 0. Override this with its actual value in
+ * the code of the multiblock.
*/
public int getPollutionPerSecond(ItemStack aStack) {
return 0;
@@ -544,8 +529,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
}
public int getRepairStatus() {
- return (mWrench ? 1 : 0)
- + (mScrewdriver ? 1 : 0)
+ return (mWrench ? 1 : 0) + (mScrewdriver ? 1 : 0)
+ (mSoftHammer ? 1 : 0)
+ (mHardHammer ? 1 : 0)
+ (mSolderingTool ? 1 : 0)
@@ -590,18 +574,14 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
break;
}
}
- if (mInventory[1] != null
- && getBaseMetaTileEntity().getRandomNumber(2) == 0
+ if (mInventory[1] != null && getBaseMetaTileEntity().getRandomNumber(2) == 0
&& !mInventory[1].getUnlocalizedName().startsWith("gt.blockmachines.basicmachine.")) {
if (mInventory[1].getItem() instanceof GT_MetaGenerated_Tool_01) {
NBTTagCompound tNBT = mInventory[1].getTagCompound();
- ((GT_MetaGenerated_Tool) mInventory[1].getItem())
- .doDamage(
- mInventory[1],
- (long) getDamageToComponent(mInventory[1])
- * (long) Math.min(
- mEUt / this.damageFactorLow,
- Math.pow(mEUt, this.damageFactorHigh)));
+ ((GT_MetaGenerated_Tool) mInventory[1].getItem()).doDamage(
+ mInventory[1],
+ (long) getDamageToComponent(mInventory[1]) * (long) Math
+ .min(mEUt / this.damageFactorLow, Math.pow(mEUt, this.damageFactorHigh)));
if (mInventory[1].stackSize == 0) mInventory[1] = null;
}
}
@@ -612,10 +592,14 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
public void explodeMultiblock() {
GT_Log.exp.println(
- "MultiBlockExplosion at: " + this.getBaseMetaTileEntity().getXCoord() + " | "
- + this.getBaseMetaTileEntity().getYCoord() + " | "
- + this.getBaseMetaTileEntity().getZCoord() + " DIMID: "
- + this.getBaseMetaTileEntity().getWorld().provider.dimensionId + ".");
+ "MultiBlockExplosion at: " + this.getBaseMetaTileEntity().getXCoord()
+ + " | "
+ + this.getBaseMetaTileEntity().getYCoord()
+ + " | "
+ + this.getBaseMetaTileEntity().getZCoord()
+ + " DIMID: "
+ + this.getBaseMetaTileEntity().getWorld().provider.dimensionId
+ + ".");
GT_Pollution.addPollution(getBaseMetaTileEntity(), GT_Mod.gregtechproxy.mPollutionOnExplosion);
mInventory[1] = null;
@@ -703,21 +687,21 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
public long getMaxInputVoltage() {
long rVoltage = 0;
for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches)
- if (isValidMetaTileEntity(tHatch))
- rVoltage += tHatch.getBaseMetaTileEntity().getInputVoltage();
+ if (isValidMetaTileEntity(tHatch)) rVoltage += tHatch.getBaseMetaTileEntity().getInputVoltage();
return rVoltage;
}
/**
* Calcualtes the overclockedness using long integers
- * @param aEUt - recipe EUt
- * @param aDuration - recipe Duration
- * @param mAmperage - should be 1 ?
- * @param maxInputVoltage - Multiblock Max input voltage
- * @param perfectOC - If the Multiblock OCs perfectly, i.e. the large Chemical Reactor
+ *
+ * @param aEUt - recipe EUt
+ * @param aDuration - recipe Duration
+ * @param mAmperage - should be 1 ?
+ * @param maxInputVoltage - Multiblock Max input voltage
+ * @param perfectOC - If the Multiblock OCs perfectly, i.e. the large Chemical Reactor
*/
- protected void calculateOverclockedNessMultiInternal(
- long aEUt, int aDuration, int mAmperage, long maxInputVoltage, boolean perfectOC) {
+ protected void calculateOverclockedNessMultiInternal(long aEUt, int aDuration, int mAmperage, long maxInputVoltage,
+ boolean perfectOC) {
byte mTier = (byte) Math.max(0, GT_Utility.getTier(maxInputVoltage));
if (mTier == 0) {
// Long time calculation
@@ -784,16 +768,13 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
public boolean drainEnergyInput(long aEU) {
if (aEU <= 0) return true;
- for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches)
- if (isValidMetaTileEntity(tHatch)) {
- if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEU, false)) return true;
- }
+ for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) if (isValidMetaTileEntity(tHatch)) {
+ if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEU, false)) return true;
+ }
return false;
}
- protected static boolean dumpFluid(
- List<GT_MetaTileEntity_Hatch_Output> aOutputHatches,
- FluidStack copiedFluidStack,
+ protected static boolean dumpFluid(List<GT_MetaTileEntity_Hatch_Output> aOutputHatches, FluidStack copiedFluidStack,
boolean restrictiveHatchesOnly) {
for (GT_MetaTileEntity_Hatch_Output tHatch : aOutputHatches) {
if (!isValidMetaTileEntity(tHatch) || (restrictiveHatchesOnly && tHatch.mMode == 0)) {
@@ -871,8 +852,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) {
tHatch.mRecipeMap = getRecipeMap();
if (isValidMetaTileEntity(tHatch)) {
- if (GT_Utility.areStacksEqual(
- aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(0))) {
+ if (GT_Utility.areStacksEqual(aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(0))) {
if (tHatch.getBaseMetaTileEntity().getStackInSlot(0).stackSize >= aStack.stackSize) {
tHatch.getBaseMetaTileEntity().decrStackSize(0, aStack.stackSize);
return true;
@@ -884,8 +864,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
tHatch.mRecipeMap = getRecipeMap();
if (isValidMetaTileEntity(tHatch)) {
for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) {
- if (GT_Utility.areStacksEqual(
- aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(i))) {
+ if (GT_Utility.areStacksEqual(aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(i))) {
if (tHatch.getBaseMetaTileEntity().getStackInSlot(i).stackSize >= aStack.stackSize) {
tHatch.getBaseMetaTileEntity().decrStackSize(i, aStack.stackSize);
return true;
@@ -899,11 +878,11 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
public ArrayList<ItemStack> getStoredOutputs() {
ArrayList<ItemStack> rList = new ArrayList<>();
- // for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) {
- // if (isValidMetaTileEntity(tHatch)) {
- // rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(1));
- // }
- // }
+ // for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) {
+ // if (isValidMetaTileEntity(tHatch)) {
+ // rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(1));
+ // }
+ // }
for (GT_MetaTileEntity_Hatch_OutputBus tHatch : mOutputBusses) {
if (isValidMetaTileEntity(tHatch)) {
for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) {
@@ -974,8 +953,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
if (isValidMetaTileEntity(tHatch)) tHatch.endRecipeProcessing();
}
- protected static <T extends GT_MetaTileEntity_Hatch> T identifyHatch(
- IGregTechTileEntity aTileEntity, int aBaseCasingIndex, Class<T> clazz) {
+ protected static <T extends GT_MetaTileEntity_Hatch> T identifyHatch(IGregTechTileEntity aTileEntity,
+ int aBaseCasingIndex, Class<T> clazz) {
if (aTileEntity == null) return null;
IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
if (!clazz.isInstance(aMetaTileEntity)) return null;
@@ -1148,29 +1127,55 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
}
return new String[] {
- /* 1*/ StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + EnumChatFormatting.GREEN
- + GT_Utility.formatNumbers(mProgresstime / 20) + EnumChatFormatting.RESET + " s / "
- + EnumChatFormatting.YELLOW
- + GT_Utility.formatNumbers(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s",
- /* 2*/ StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + EnumChatFormatting.GREEN
- + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / "
- + EnumChatFormatting.YELLOW
- + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU",
- /* 3*/ StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " + EnumChatFormatting.RED
- + GT_Utility.formatNumbers(getActualEnergyUsage()) + EnumChatFormatting.RESET + " EU/t",
- /* 4*/ StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + EnumChatFormatting.YELLOW
- + GT_Utility.formatNumbers(getMaxInputVoltage()) + EnumChatFormatting.RESET + " EU/t(*2A) "
- + StatCollector.translateToLocal("GT5U.machines.tier")
- + ": " + EnumChatFormatting.YELLOW
- + VN[GT_Utility.getTier(getMaxInputVoltage())] + EnumChatFormatting.RESET,
- /* 5*/ StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " + EnumChatFormatting.RED
- + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " "
- + StatCollector.translateToLocal("GT5U.multiblock.efficiency")
- + ": " + EnumChatFormatting.YELLOW
- + Float.toString(mEfficiency / 100.0F) + EnumChatFormatting.RESET + " %",
- /* 6*/ StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " + EnumChatFormatting.GREEN
- + mPollutionReduction + EnumChatFormatting.RESET + " %"
- };
+ /* 1 */ StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": "
+ + EnumChatFormatting.GREEN
+ + GT_Utility.formatNumbers(mProgresstime / 20)
+ + EnumChatFormatting.RESET
+ + " s / "
+ + EnumChatFormatting.YELLOW
+ + GT_Utility.formatNumbers(mMaxProgresstime / 20)
+ + EnumChatFormatting.RESET
+ + " s",
+ /* 2 */ StatCollector.translateToLocal("GT5U.multiblock.energy") + ": "
+ + EnumChatFormatting.GREEN
+ + GT_Utility.formatNumbers(storedEnergy)
+ + EnumChatFormatting.RESET
+ + " EU / "
+ + EnumChatFormatting.YELLOW
+ + GT_Utility.formatNumbers(maxEnergy)
+ + EnumChatFormatting.RESET
+ + " EU",
+ /* 3 */ StatCollector.translateToLocal("GT5U.multiblock.usage") + ": "
+ + EnumChatFormatting.RED
+ + GT_Utility.formatNumbers(getActualEnergyUsage())
+ + EnumChatFormatting.RESET
+ + " EU/t",
+ /* 4 */ StatCollector.translateToLocal("GT5U.multiblock.mei") + ": "
+ + EnumChatFormatting.YELLOW
+ + GT_Utility.formatNumbers(getMaxInputVoltage())
+ + EnumChatFormatting.RESET
+ + " EU/t(*2A) "
+ + StatCollector.translateToLocal("GT5U.machines.tier")
+ + ": "
+ + EnumChatFormatting.YELLOW
+ + VN[GT_Utility.getTier(getMaxInputVoltage())]
+ + EnumChatFormatting.RESET,
+ /* 5 */ StatCollector.translateToLocal("GT5U.multiblock.problems") + ": "
+ + EnumChatFormatting.RED
+ + (getIdealStatus() - getRepairStatus())
+ + EnumChatFormatting.RESET
+ + " "
+ + StatCollector.translateToLocal("GT5U.multiblock.efficiency")
+ + ": "
+ + EnumChatFormatting.YELLOW
+ + Float.toString(mEfficiency / 100.0F)
+ + EnumChatFormatting.RESET
+ + " %",
+ /* 6 */ StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": "
+ + EnumChatFormatting.GREEN
+ + mPollutionReduction
+ + EnumChatFormatting.RESET
+ + " %" };
}
@Override
@@ -1230,29 +1235,34 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
}
@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();
if (tag.getBoolean("incompleteStructure")) {
currentTip.add(RED + "** INCOMPLETE STRUCTURE **" + RESET);
}
- currentTip.add((tag.getBoolean("hasProblems") ? (RED + "** HAS PROBLEMS **") : GREEN + "Running Fine") + RESET
- + " Efficiency: " + tag.getFloat("efficiency") + "%");
+ currentTip.add(
+ (tag.getBoolean("hasProblems") ? (RED + "** HAS PROBLEMS **") : GREEN + "Running Fine") + RESET
+ + " Efficiency: "
+ + tag.getFloat("efficiency")
+ + "%");
boolean isActive = tag.getBoolean("isActive");
if (isActive) {
long actualEnergyUsage = tag.getLong("energyUsage");
if (actualEnergyUsage > 0) {
- currentTip.add(StatCollector.translateToLocalFormatted(
- "GT5U.waila.energy.use",
- GT_Utility.formatNumbers(actualEnergyUsage),
- GT_Utility.getColoredTierNameFromVoltage(actualEnergyUsage)));
+ currentTip.add(
+ StatCollector.translateToLocalFormatted(
+ "GT5U.waila.energy.use",
+ GT_Utility.formatNumbers(actualEnergyUsage),
+ GT_Utility.getColoredTierNameFromVoltage(actualEnergyUsage)));
} else if (actualEnergyUsage < 0) {
- currentTip.add(StatCollector.translateToLocalFormatted(
- "GT5U.waila.energy.produce",
- GT_Utility.formatNumbers(-actualEnergyUsage),
- GT_Utility.getColoredTierNameFromVoltage(-actualEnergyUsage)));
+ currentTip.add(
+ StatCollector.translateToLocalFormatted(
+ "GT5U.waila.energy.produce",
+ GT_Utility.formatNumbers(-actualEnergyUsage),
+ GT_Utility.getColoredTierNameFromVoltage(-actualEnergyUsage)));
}
}
currentTip.add(
@@ -1262,8 +1272,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
}
@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("hasProblems", (getIdealStatus() - getRepairStatus()) > 0);
@@ -1334,10 +1344,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
@Override
public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) {
- builder.widget(new DrawableWidget()
- .setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK)
- .setPos(7, 4)
- .setSize(143, 75));
+ builder.widget(
+ new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK).setPos(7, 4).setSize(143, 75));
final SlotWidget inventorySlot = new SlotWidget(inventoryHandler, 1);
builder.widget(inventorySlot.setPos(151, 4));
@@ -1353,94 +1361,99 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
screenElements.setSynced(false).setSpace(0).setPos(10, 7);
screenElements
- .widget(new TextWidget(GT_Utility.trans("132", "Pipe is loose."))
- .setDefaultColor(COLOR_TEXT_WHITE.get())
- .setEnabled(widget -> !mWrench))
+ .widget(
+ new TextWidget(GT_Utility.trans("132", "Pipe is loose."))
+ .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mWrench))
.widget(new FakeSyncWidget.BooleanSyncer(() -> mWrench, val -> mWrench = val));
screenElements
- .widget(new TextWidget(GT_Utility.trans("133", "Screws are loose."))
- .setDefaultColor(COLOR_TEXT_WHITE.get())
- .setEnabled(widget -> !mScrewdriver))
+ .widget(
+ new TextWidget(GT_Utility.trans("133", "Screws are loose."))
+ .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mScrewdriver))
.widget(new FakeSyncWidget.BooleanSyncer(() -> mScrewdriver, val -> mScrewdriver = val));
screenElements
- .widget(new TextWidget(GT_Utility.trans("134", "Something is stuck."))
- .setDefaultColor(COLOR_TEXT_WHITE.get())
- .setEnabled(widget -> !mSoftHammer))
+ .widget(
+ new TextWidget(GT_Utility.trans("134", "Something is stuck."))
+ .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mSoftHammer))
.widget(new FakeSyncWidget.BooleanSyncer(() -> mSoftHammer, val -> mSoftHammer = val));
screenElements
- .widget(new TextWidget(GT_Utility.trans("135", "Platings are dented."))
- .setDefaultColor(COLOR_TEXT_WHITE.get())
- .setEnabled(widget -> !mHardHammer))
+ .widget(
+ new TextWidget(GT_Utility.trans("135", "Platings are dented."))
+ .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mHardHammer))
.widget(new FakeSyncWidget.BooleanSyncer(() -> mHardHammer, val -> mHardHammer = val));
screenElements
- .widget(new TextWidget(GT_Utility.trans("136", "Circuitry burned out."))
- .setDefaultColor(COLOR_TEXT_WHITE.get())
- .setEnabled(widget -> !mSolderingTool))
+ .widget(
+ new TextWidget(GT_Utility.trans("136", "Circuitry burned out."))
+ .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mSolderingTool))
.widget(new FakeSyncWidget.BooleanSyncer(() -> mSolderingTool, val -> mSolderingTool = val));
screenElements
- .widget(new TextWidget(GT_Utility.trans("137", "That doesn't belong there."))
- .setDefaultColor(COLOR_TEXT_WHITE.get())
- .setEnabled(widget -> !mCrowbar))
+ .widget(
+ new TextWidget(GT_Utility.trans("137", "That doesn't belong there."))
+ .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mCrowbar))
.widget(new FakeSyncWidget.BooleanSyncer(() -> mCrowbar, val -> mCrowbar = val));
screenElements
- .widget(new TextWidget(GT_Utility.trans("138", "Incomplete Structure."))
- .setDefaultColor(COLOR_TEXT_WHITE.get())
- .setEnabled(widget -> !mMachine))
+ .widget(
+ new TextWidget(GT_Utility.trans("138", "Incomplete Structure."))
+ .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mMachine))
.widget(new FakeSyncWidget.BooleanSyncer(() -> mMachine, val -> mMachine = val));
- screenElements.widget(new TextWidget("Too Uncertain.")
- .setDefaultColor(COLOR_TEXT_WHITE.get())
- .setEnabled(widget -> (getBaseMetaTileEntity().getErrorDisplayID() & 128) != 0));
- screenElements.widget(new TextWidget("Invalid Parameters.")
- .setDefaultColor(COLOR_TEXT_WHITE.get())
- .setEnabled(widget -> (getBaseMetaTileEntity().getErrorDisplayID() & 256) != 0));
+ screenElements.widget(
+ new TextWidget("Too Uncertain.").setDefaultColor(COLOR_TEXT_WHITE.get())
+ .setEnabled(widget -> (getBaseMetaTileEntity().getErrorDisplayID() & 128) != 0));
+ screenElements.widget(
+ new TextWidget("Invalid Parameters.").setDefaultColor(COLOR_TEXT_WHITE.get())
+ .setEnabled(widget -> (getBaseMetaTileEntity().getErrorDisplayID() & 256) != 0));
screenElements
- .widget(new TextWidget(GT_Utility.trans("139", "Hit with Soft Mallet"))
- .setDefaultColor(COLOR_TEXT_WHITE.get())
- .setEnabled(widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0
- && !getBaseMetaTileEntity().isActive()))
- .widget(new FakeSyncWidget.IntegerSyncer(
- () -> getBaseMetaTileEntity().getErrorDisplayID(),
- val -> getBaseMetaTileEntity().setErrorDisplayID(val)))
- .widget(new FakeSyncWidget.BooleanSyncer(
- () -> getBaseMetaTileEntity().isActive(),
- val -> getBaseMetaTileEntity().setActive(val)));
- screenElements.widget(new TextWidget(GT_Utility.trans("140", "to (re-)start the Machine"))
- .setDefaultColor(COLOR_TEXT_WHITE.get())
- .setEnabled(widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0
- && !getBaseMetaTileEntity().isActive()));
- screenElements.widget(new TextWidget(GT_Utility.trans("141", "if it doesn't start."))
- .setDefaultColor(COLOR_TEXT_WHITE.get())
- .setEnabled(widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0
- && !getBaseMetaTileEntity().isActive()));
- screenElements.widget(new TextWidget(GT_Utility.trans("142", "Running perfectly."))
- .setDefaultColor(COLOR_TEXT_WHITE.get())
- .setEnabled(widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0
- && getBaseMetaTileEntity().isActive()));
-
- screenElements.widget(new TextWidget(GT_Utility.trans("143", "Missing Mining Pipe"))
- .setDefaultColor(COLOR_TEXT_WHITE.get())
- .setEnabled(widget -> {
- if (getBaseMetaTileEntity().getErrorDisplayID() == 0
- && this instanceof GT_MetaTileEntity_DrillerBase) {
- final ItemStack tItem = inventorySlot.getMcSlot().getStack();
- return tItem == null
- || !GT_Utility.areStacksEqual(tItem, GT_ModHandler.getIC2Item("miningPipe", 1L));
- }
- return false;
- }));
- screenElements.widget(new TextWidget(GT_Utility.trans("144", "Missing Turbine Rotor"))
- .setDefaultColor(COLOR_TEXT_WHITE.get())
- .setEnabled(widget -> {
- if (getBaseMetaTileEntity().getErrorDisplayID() == 0
- && this instanceof GT_MetaTileEntity_LargeTurbine) {
- final ItemStack tItem = inventorySlot.getMcSlot().getStack();
- return tItem == null
- || !(tItem.getItem() == GT_MetaGenerated_Tool_01.INSTANCE
+ .widget(
+ new TextWidget(GT_Utility.trans("139", "Hit with Soft Mallet"))
+ .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(
+ widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0
+ && !getBaseMetaTileEntity().isActive()))
+ .widget(
+ new FakeSyncWidget.IntegerSyncer(
+ () -> getBaseMetaTileEntity().getErrorDisplayID(),
+ val -> getBaseMetaTileEntity().setErrorDisplayID(val)))
+ .widget(
+ new FakeSyncWidget.BooleanSyncer(
+ () -> getBaseMetaTileEntity().isActive(),
+ val -> getBaseMetaTileEntity().setActive(val)));
+ screenElements.widget(
+ new TextWidget(GT_Utility.trans("140", "to (re-)start the Machine"))
+ .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(
+ widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0
+ && !getBaseMetaTileEntity().isActive()));
+ screenElements.widget(
+ new TextWidget(GT_Utility.trans("141", "if it doesn't start.")).setDefaultColor(COLOR_TEXT_WHITE.get())
+ .setEnabled(
+ widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0
+ && !getBaseMetaTileEntity().isActive()));
+ screenElements.widget(
+ new TextWidget(GT_Utility.trans("142", "Running perfectly.")).setDefaultColor(COLOR_TEXT_WHITE.get())
+ .setEnabled(
+ widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0
+ && getBaseMetaTileEntity().isActive()));
+
+ screenElements.widget(
+ new TextWidget(GT_Utility.trans("143", "Missing Mining Pipe")).setDefaultColor(COLOR_TEXT_WHITE.get())
+ .setEnabled(widget -> {
+ if (getBaseMetaTileEntity().getErrorDisplayID() == 0
+ && this instanceof GT_MetaTileEntity_DrillerBase) {
+ final ItemStack tItem = inventorySlot.getMcSlot().getStack();
+ return tItem == null || !GT_Utility
+ .areStacksEqual(tItem, GT_ModHandler.getIC2Item("miningPipe", 1L));
+ }
+ return false;
+ }));
+ screenElements.widget(
+ new TextWidget(GT_Utility.trans("144", "Missing Turbine Rotor")).setDefaultColor(COLOR_TEXT_WHITE.get())
+ .setEnabled(widget -> {
+ if (getBaseMetaTileEntity().getErrorDisplayID() == 0
+ && this instanceof GT_MetaTileEntity_LargeTurbine) {
+ final ItemStack tItem = inventorySlot.getMcSlot().getStack();
+ return tItem == null || !(tItem.getItem() == GT_MetaGenerated_Tool_01.INSTANCE
&& tItem.getItemDamage() >= 170
&& tItem.getItemDamage() <= 177);
- }
- return false;
- }));
+ }
+ return false;
+ }));
}
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SpecialFilter.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SpecialFilter.java
index f146b39635..6becb5e806 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SpecialFilter.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SpecialFilter.java
@@ -1,5 +1,11 @@
package gregtech.api.metatileentity.implementations;
+import java.util.Collections;
+import java.util.List;
+
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
import com.gtnewhorizons.modularui.api.drawable.Text;
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
@@ -8,35 +14,33 @@ import com.gtnewhorizons.modularui.common.widget.ButtonWidget;
import com.gtnewhorizons.modularui.common.widget.DrawableWidget;
import com.gtnewhorizons.modularui.common.widget.SlotGroup;
import com.gtnewhorizons.modularui.common.widget.SlotWidget;
+
import gregtech.api.gui.modularui.GT_UITextures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.modularui.IAddUIWidgets;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.util.GT_Utility;
-import java.util.Collections;
-import java.util.List;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
public abstract class GT_MetaTileEntity_SpecialFilter extends GT_MetaTileEntity_Buffer implements IAddUIWidgets {
+
public static final int BUFFER_SLOT_COUNT = 9;
public static final int SPECIAL_SLOT_INDEX = 9;
public boolean bNBTAllowed = false;
public boolean bInvertFilter = false;
- public GT_MetaTileEntity_SpecialFilter(
- int aID, String aName, String aNameRegional, int aTier, String[] aDescription) {
+ public GT_MetaTileEntity_SpecialFilter(int aID, String aName, String aNameRegional, int aTier,
+ String[] aDescription) {
// 9 buffer slot, 1 representation slot, 1 holo slot. last seems not needed...
super(aID, aName, aNameRegional, aTier, 11, aDescription);
}
- public GT_MetaTileEntity_SpecialFilter(
- String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_SpecialFilter(String aName, int aTier, int aInvSlotCount, String aDescription,
+ ITexture[][][] aTextures) {
super(aName, aTier, aInvSlotCount, aDescription, aTextures);
}
- public GT_MetaTileEntity_SpecialFilter(
- String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_SpecialFilter(String aName, int aTier, int aInvSlotCount, String[] aDescription,
+ ITexture[][][] aTextures) {
super(aName, aTier, aInvSlotCount, aDescription, aTextures);
}
@@ -83,73 +87,61 @@ public abstract class GT_MetaTileEntity_SpecialFilter extends GT_MetaTileEntity_
addEmitEnergyButton(builder);
addEmitRedstoneButton(builder);
addInvertRedstoneButton(builder);
- builder.widget(new ButtonWidget()
- .setOnClick((clickData, widget) -> {
- bInvertFilter = !bInvertFilter;
- if (bInvertFilter) {
- GT_Utility.sendChatToPlayer(
- widget.getContext().getPlayer(), GT_Utility.trans("124", "Invert Filter"));
- } else {
- GT_Utility.sendChatToPlayer(
- widget.getContext().getPlayer(),
- GT_Utility.trans("125", "Don't invert Filter"));
- }
- })
- .setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_INVERT_FILTER)
- .setPos(61, 62)
+ builder.widget(new ButtonWidget().setOnClick((clickData, widget) -> {
+ bInvertFilter = !bInvertFilter;
+ if (bInvertFilter) {
+ GT_Utility.sendChatToPlayer(widget.getContext().getPlayer(), GT_Utility.trans("124", "Invert Filter"));
+ } else {
+ GT_Utility.sendChatToPlayer(
+ widget.getContext().getPlayer(),
+ GT_Utility.trans("125", "Don't invert Filter"));
+ }
+ }).setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_INVERT_FILTER).setPos(61, 62)
+ .setSize(18, 18)).widget(new ButtonWidget().setOnClick((clickData, widget) -> {
+ bNBTAllowed = !bNBTAllowed;
+ if (bNBTAllowed) {
+ GT_Utility.sendChatToPlayer(
+ widget.getContext().getPlayer(),
+ GT_Utility.trans("126", "Ignore NBT"));
+ } else {
+ GT_Utility.sendChatToPlayer(
+ widget.getContext().getPlayer(),
+ GT_Utility.trans("127", "NBT has to match"));
+ }
+ }).setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_NBT).setPos(79, 62)
.setSize(18, 18))
- .widget(new ButtonWidget()
- .setOnClick((clickData, widget) -> {
- bNBTAllowed = !bNBTAllowed;
- if (bNBTAllowed) {
- GT_Utility.sendChatToPlayer(
- widget.getContext().getPlayer(), GT_Utility.trans("126", "Ignore NBT"));
- } else {
- GT_Utility.sendChatToPlayer(
- widget.getContext().getPlayer(), GT_Utility.trans("127", "NBT has to match"));
- }
- })
- .setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_NBT)
- .setPos(79, 62)
- .setSize(18, 18))
- .widget(new DrawableWidget()
- .setDrawable(GT_UITextures.PICTURE_ARROW_24_WHITE.apply(27, false))
- .setPos(6, 19)
- .setSize(27, 24))
- .widget(new DrawableWidget()
- .setDrawable(GT_UITextures.PICTURE_ARROW_24_BLUE.apply(42, true))
- .setPos(53, 19)
- .setSize(42, 24))
- .widget(new DrawableWidget()
- .setDrawable(GT_UITextures.PICTURE_ARROW_24_RED.apply(19, true))
- .setPos(152, 19)
- .setSize(19, 24))
.widget(
- new SlotWidget(BaseSlot.phantom(inventoryHandler, 9)) {
- @Override
- protected void phantomClick(ClickData clickData, ItemStack cursorStack) {
- clickTypeIcon(clickData.mouseButton != 0, cursorStack);
- }
-
- @Override
- public void buildTooltip(List<Text> tooltip) {
- if (getEmptySlotTooltip() != null) {
- tooltip.addAll(getEmptySlotTooltip());
- }
- super.buildTooltip(tooltip);
- }
-
- @Override
- public List<String> getExtraTooltip() {
- if (getItemExtraTooltip() != null) {
- return getItemExtraTooltip();
- }
- return Collections.emptyList();
- }
- }.disableShiftInsert().setPos(34, 22).setBackground(GT_UITextures.BUTTON_STANDARD))
- .widget(SlotGroup.ofItemHandler(inventoryHandler, 3)
- .endAtSlot(8)
- .build()
- .setPos(97, 4));
+ new DrawableWidget().setDrawable(GT_UITextures.PICTURE_ARROW_24_WHITE.apply(27, false))
+ .setPos(6, 19).setSize(27, 24))
+ .widget(
+ new DrawableWidget().setDrawable(GT_UITextures.PICTURE_ARROW_24_BLUE.apply(42, true))
+ .setPos(53, 19).setSize(42, 24))
+ .widget(
+ new DrawableWidget().setDrawable(GT_UITextures.PICTURE_ARROW_24_RED.apply(19, true))
+ .setPos(152, 19).setSize(19, 24))
+ .widget(new SlotWidget(BaseSlot.phantom(inventoryHandler, 9)) {
+
+ @Override
+ protected void phantomClick(ClickData clickData, ItemStack cursorStack) {
+ clickTypeIcon(clickData.mouseButton != 0, cursorStack);
+ }
+
+ @Override
+ public void buildTooltip(List<Text> tooltip) {
+ if (getEmptySlotTooltip() != null) {
+ tooltip.addAll(getEmptySlotTooltip());
+ }
+ super.buildTooltip(tooltip);
+ }
+
+ @Override
+ public List<String> getExtraTooltip() {
+ if (getItemExtraTooltip() != null) {
+ return getItemExtraTooltip();
+ }
+ return Collections.emptyList();
+ }
+ }.disableShiftInsert().setPos(34, 22).setBackground(GT_UITextures.BUTTON_STANDARD))
+ .widget(SlotGroup.ofItemHandler(inventoryHandler, 3).endAtSlot(8).build().setPos(97, 4));
}
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java
index 21267f983e..9c069bbd5f 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java
@@ -6,6 +6,7 @@ import static gregtech.api.metatileentity.BaseTileEntity.BATTERY_SLOT_TOOLTIP_AL
import static gregtech.api.metatileentity.BaseTileEntity.TOOLTIP_DELAY;
import com.gtnewhorizons.modularui.common.widget.SlotWidget;
+
import gregtech.api.enums.GT_Values;
import gregtech.api.gui.modularui.GT_UITextures;
import gregtech.api.interfaces.ITexture;
@@ -14,9 +15,9 @@ import gregtech.api.util.GT_Utility;
import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_Cleanroom;
public abstract class GT_MetaTileEntity_TieredMachineBlock extends MetaTileEntity {
+
/**
- * Value between [0 - 9] to describe the Tier of this Machine.
- * PLZ [0-15] works - READ! GT_Values class.
+ * Value between [0 - 9] to describe the Tier of this Machine. PLZ [0-15] works - READ! GT_Values class.
*/
public final byte mTier;
@@ -33,31 +34,19 @@ public abstract class GT_MetaTileEntity_TieredMachineBlock extends MetaTileEntit
*/
public final ITexture[][][] mTextures;
- public GT_MetaTileEntity_TieredMachineBlock(
- int aID,
- String aName,
- String aNameRegional,
- int aTier,
- int aInvSlotCount,
- String aDescription,
- ITexture... aTextures) {
+ public GT_MetaTileEntity_TieredMachineBlock(int aID, String aName, String aNameRegional, int aTier,
+ int aInvSlotCount, String aDescription, ITexture... aTextures) {
super(aID, aName, aNameRegional, aInvSlotCount);
mTier = (byte) Math.max(0, Math.min(aTier, 14));
- mDescriptionArray = aDescription == null ? new String[0] : new String[] {aDescription};
+ mDescriptionArray = aDescription == null ? new String[0] : new String[] { aDescription };
mDescription = mDescriptionArray.length > 0 ? mDescriptionArray[0] : "";
// must always be the last call!
if (GT.isClientSide()) mTextures = getTextureSet(aTextures);
else mTextures = null;
}
- public GT_MetaTileEntity_TieredMachineBlock(
- int aID,
- String aName,
- String aNameRegional,
- int aTier,
- int aInvSlotCount,
- String[] aDescription,
- ITexture... aTextures) {
+ public GT_MetaTileEntity_TieredMachineBlock(int aID, String aName, String aNameRegional, int aTier,
+ int aInvSlotCount, String[] aDescription, ITexture... aTextures) {
super(aID, aName, aNameRegional, aInvSlotCount);
mTier = (byte) Math.max(0, Math.min(aTier, 15));
mDescriptionArray = aDescription == null ? new String[0] : aDescription;
@@ -73,17 +62,17 @@ public abstract class GT_MetaTileEntity_TieredMachineBlock extends MetaTileEntit
return GT_MetaTileEntity_Cleanroom.class;
}
- public GT_MetaTileEntity_TieredMachineBlock(
- String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_TieredMachineBlock(String aName, int aTier, int aInvSlotCount, String aDescription,
+ ITexture[][][] aTextures) {
super(aName, aInvSlotCount);
mTier = (byte) aTier;
- mDescriptionArray = aDescription == null ? new String[0] : new String[] {aDescription};
+ mDescriptionArray = aDescription == null ? new String[0] : new String[] { aDescription };
mDescription = mDescriptionArray.length > 0 ? mDescriptionArray[0] : "";
mTextures = aTextures;
}
- public GT_MetaTileEntity_TieredMachineBlock(
- String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_TieredMachineBlock(String aName, int aTier, int aInvSlotCount, String[] aDescription,
+ ITexture[][][] aTextures) {
super(aName, aInvSlotCount);
mTier = (byte) aTier;
mDescriptionArray = aDescription == null ? new String[0] : aDescription;
@@ -112,8 +101,8 @@ public abstract class GT_MetaTileEntity_TieredMachineBlock extends MetaTileEntit
}
/**
- * Used Client Side to get a Texture Set for this Block.
- * Called after setting the Tier and the Description so that those two are accessible.
+ * Used Client Side to get a Texture Set for this Block. Called after setting the Tier and the Description so that
+ * those two are accessible.
*
* @param aTextures is the optional Array you can give to the Constructor.
*/
@@ -125,20 +114,17 @@ public abstract class GT_MetaTileEntity_TieredMachineBlock extends MetaTileEntit
final String pTier1 = GT_Utility.getColoredTierNameFromTier(mTier);
if (mTier == GT_Values.VN.length - 1) {
batterySlotTooltipKey = BATTERY_SLOT_TOOLTIP_ALT;
- batterySlotTooltipArgs = new String[] {pTier1};
+ batterySlotTooltipArgs = new String[] { pTier1 };
} else {
batterySlotTooltipKey = BATTERY_SLOT_TOOLTIP;
- batterySlotTooltipArgs = new String[] {pTier1, GT_Utility.getColoredTierNameFromTier((byte) (mTier + 1))};
+ batterySlotTooltipArgs = new String[] { pTier1, GT_Utility.getColoredTierNameFromTier((byte) (mTier + 1)) };
}
return createChargerSlot(x, y, batterySlotTooltipKey, batterySlotTooltipArgs);
}
protected SlotWidget createChargerSlot(int x, int y, String tooltipKey, Object[] tooltipArgs) {
- return (SlotWidget) new SlotWidget(inventoryHandler, rechargerSlotStartIndex())
- .disableShiftInsert()
- .setGTTooltip(() -> mTooltipCache.getData(tooltipKey, tooltipArgs))
- .setTooltipShowUpDelay(TOOLTIP_DELAY)
- .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_CHARGER)
- .setPos(x, y);
+ return (SlotWidget) new SlotWidget(inventoryHandler, rechargerSlotStartIndex()).disableShiftInsert()
+ .setGTTooltip(() -> mTooltipCache.getData(tooltipKey, tooltipArgs)).setTooltipShowUpDelay(TOOLTIP_DELAY)
+ .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_CHARGER).setPos(x, y);
}
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TooltipMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TooltipMultiBlockBase.java
index e564c65d21..a4c42dd14d 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TooltipMultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TooltipMultiBlockBase.java
@@ -1,18 +1,21 @@
package gregtech.api.metatileentity.implementations;
+import java.util.concurrent.atomic.AtomicReferenceArray;
+
+import org.lwjgl.input.Keyboard;
+
import gregtech.api.GregTech_API;
import gregtech.api.interfaces.ISecondaryDescribable;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
-import java.util.concurrent.atomic.AtomicReferenceArray;
-import org.lwjgl.input.Keyboard;
/**
* A multiblock with tooltip {@link GT_Multiblock_Tooltip_Builder}
*/
public abstract class GT_MetaTileEntity_TooltipMultiBlockBase extends GT_MetaTileEntity_MultiBlockBase
implements ISecondaryDescribable {
- private static final AtomicReferenceArray<GT_Multiblock_Tooltip_Builder> tooltips =
- new AtomicReferenceArray<>(GregTech_API.METATILEENTITIES.length);
+
+ private static final AtomicReferenceArray<GT_Multiblock_Tooltip_Builder> tooltips = new AtomicReferenceArray<>(
+ GregTech_API.METATILEENTITIES.length);
public GT_MetaTileEntity_TooltipMultiBlockBase(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java
index 0f6f6249a5..a70ee0d5e7 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java
@@ -7,6 +7,19 @@ 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 java.util.List;
+
+import mcp.mobius.waila.api.IWailaConfigHandler;
+import mcp.mobius.waila.api.IWailaDataAccessor;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+
import cofh.api.energy.IEnergyProvider;
import cofh.api.energy.IEnergyStorage;
import crazypants.enderio.machine.capbank.TileCapBank;
@@ -19,24 +32,15 @@ import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.util.GT_Utility;
-import java.util.List;
-import mcp.mobius.waila.api.IWailaConfigHandler;
-import mcp.mobius.waila.api.IWailaDataAccessor;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.world.World;
-import net.minecraftforge.common.util.ForgeDirection;
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
* <p/>
- * This is the main construct for my Basic Machines such as the Automatic Extractor
- * Extend this class to make a simple Machine
+ * This is the main construct for my Basic Machines such as the Automatic Extractor Extend this class to make a simple
+ * Machine
*/
public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachineBlock {
+
public GT_MetaTileEntity_Transformer(int aID, String aName, String aNameRegional, int aTier, String aDescription) {
super(aID, aName, aNameRegional, aTier, 0, aDescription);
}
@@ -53,57 +57,39 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi
public ITexture[][][] getTextureSet(ITexture[] aTextures) {
ITexture[][][] rTextures = new ITexture[12][17][];
for (byte i = -1; i < 16; i++) {
- rTextures[0][i + 1] = new ITexture[] {
- Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]
- };
- rTextures[1][i + 1] = new ITexture[] {
- Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]
- };
- rTextures[2][i + 1] = new ITexture[] {
- Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]
- };
- rTextures[3][i + 1] = new ITexture[] {
- Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier]
- };
- rTextures[4][i + 1] = new ITexture[] {
- Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier]
- };
- rTextures[5][i + 1] = new ITexture[] {
- Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier]
- };
- rTextures[6][i + 1] = new ITexture[] {
- Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier]
- };
- rTextures[7][i + 1] = new ITexture[] {
- Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier]
- };
- rTextures[8][i + 1] = new ITexture[] {
- Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier]
- };
- rTextures[9][i + 1] = new ITexture[] {
- Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]
- };
- rTextures[10][i + 1] = new ITexture[] {
- Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]
- };
- rTextures[11][i + 1] = new ITexture[] {
- Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]
- };
+ rTextures[0][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] };
+ rTextures[1][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] };
+ rTextures[2][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] };
+ rTextures[3][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier] };
+ rTextures[4][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier] };
+ rTextures[5][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier] };
+ rTextures[6][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier] };
+ rTextures[7][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier] };
+ rTextures[8][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier] };
+ rTextures[9][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier] };
+ rTextures[10][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier] };
+ rTextures[11][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier] };
}
return rTextures;
}
@Override
- public ITexture[] getTexture(
- IGregTechTileEntity aBaseMetaTileEntity,
- byte aSide,
- byte aFacing,
- byte aColorIndex,
- boolean aActive,
- boolean aRedstone) {
- return mTextures[
- Math.min(2, aSide) + (aSide == aFacing ? 3 : 0) + (aBaseMetaTileEntity.isAllowedToWork() ? 0 : 6)][
- aColorIndex + 1];
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex,
+ boolean aActive, boolean aRedstone) {
+ return mTextures[Math.min(2, aSide) + (aSide == aFacing ? 3 : 0)
+ + (aBaseMetaTileEntity.isAllowedToWork() ? 0 : 6)][aColorIndex + 1];
}
@Override
@@ -138,8 +124,7 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi
@Override
public boolean isInputFacing(byte aSide) {
- return getBaseMetaTileEntity().isAllowedToWork()
- ? aSide == getBaseMetaTileEntity().getFrontFacing()
+ return getBaseMetaTileEntity().isAllowedToWork() ? aSide == getBaseMetaTileEntity().getFrontFacing()
: aSide != getBaseMetaTileEntity().getFrontFacing();
}
@@ -190,55 +175,50 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi
for (byte i = 0; i < 6 && aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity(); i++)
if (aBaseMetaTileEntity.inputEnergyFrom(i)) {
TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(i);
- if (tTileEntity instanceof IEnergyProvider
- && ((IEnergyProvider) tTileEntity)
- .extractEnergy(
- ForgeDirection.getOrientation(GT_Utility.getOppositeSide(i)),
- 1,
- true)
- == 1) {
- long tEU = (long) ((IEnergyProvider) tTileEntity)
- .extractEnergy(
- ForgeDirection.getOrientation(GT_Utility.getOppositeSide(i)),
- GT_Utility.safeInt(maxEUInput() * 100L / GregTech_API.mRFtoEU),
- false);
+ if (tTileEntity instanceof IEnergyProvider && ((IEnergyProvider) tTileEntity)
+ .extractEnergy(ForgeDirection.getOrientation(GT_Utility.getOppositeSide(i)), 1, true)
+ == 1) {
+ long tEU = (long) ((IEnergyProvider) tTileEntity).extractEnergy(
+ ForgeDirection.getOrientation(GT_Utility.getOppositeSide(i)),
+ GT_Utility.safeInt(maxEUInput() * 100L / GregTech_API.mRFtoEU),
+ false);
tEU = tEU * GregTech_API.mRFtoEU / 100;
aBaseMetaTileEntity.injectEnergyUnits((byte) 6, Math.min(tEU, maxEUInput()), 1);
} else if (tTileEntity instanceof IEnergyStorage
&& ((IEnergyStorage) tTileEntity).extractEnergy(1, true) == 1) {
- long tEU = (long) ((IEnergyStorage) tTileEntity)
- .extractEnergy(GT_Utility.safeInt(maxEUInput() * 100L / GregTech_API.mRFtoEU), false);
- tEU = tEU * GregTech_API.mRFtoEU / 100;
- aBaseMetaTileEntity.injectEnergyUnits((byte) 6, Math.min(tEU, maxEUInput()), 1);
- } else if (GregTech_API.meIOLoaded
- && tTileEntity instanceof IPowerContainer
- && ((IPowerContainer) tTileEntity).getEnergyStored() > 0) {
- int storedRF = ((IPowerContainer) tTileEntity).getEnergyStored();
- int extractRF = GT_Utility.safeInt(maxEUInput() * 100L / GregTech_API.mRFtoEU);
- long tEU = 0;
- if (tTileEntity instanceof TileCapBank) {
- ICapBankNetwork network = ((TileCapBank) tTileEntity).getNetwork();
- if (network != null && network.getEnergyStoredL() > 0) {
- tEU = Math.min(
- (Math.min(
- Math.min(network.getEnergyStoredL(), storedRF - extractRF),
- network.getMaxOutput()))
- * (long) GregTech_API.mRFtoEU
- / 100L,
- maxEUInput());
- network.addEnergy(GT_Utility.safeInt(-(tEU * 100 / GregTech_API.mRFtoEU)));
- }
- } else {
- if (storedRF > extractRF) {
- ((IPowerContainer) tTileEntity).setEnergyStored(storedRF - extractRF);
- tEU = maxEUInput();
- } else {
- ((IPowerContainer) tTileEntity).setEnergyStored(0);
- tEU = storedRF * (long) GregTech_API.mRFtoEU / 100L;
- }
- }
- aBaseMetaTileEntity.injectEnergyUnits((byte) 6, Math.min(tEU, maxEUInput()), 1);
- }
+ long tEU = (long) ((IEnergyStorage) tTileEntity).extractEnergy(
+ GT_Utility.safeInt(maxEUInput() * 100L / GregTech_API.mRFtoEU),
+ false);
+ tEU = tEU * GregTech_API.mRFtoEU / 100;
+ aBaseMetaTileEntity.injectEnergyUnits((byte) 6, Math.min(tEU, maxEUInput()), 1);
+ } else
+ if (GregTech_API.meIOLoaded && tTileEntity instanceof IPowerContainer
+ && ((IPowerContainer) tTileEntity).getEnergyStored() > 0) {
+ int storedRF = ((IPowerContainer) tTileEntity).getEnergyStored();
+ int extractRF = GT_Utility.safeInt(maxEUInput() * 100L / GregTech_API.mRFtoEU);
+ long tEU = 0;
+ if (tTileEntity instanceof TileCapBank) {
+ ICapBankNetwork network = ((TileCapBank) tTileEntity).getNetwork();
+ if (network != null && network.getEnergyStoredL() > 0) {
+ tEU = Math.min(
+ (Math.min(
+ Math.min(network.getEnergyStoredL(), storedRF - extractRF),
+ network.getMaxOutput())) * (long) GregTech_API.mRFtoEU
+ / 100L,
+ maxEUInput());
+ network.addEnergy(GT_Utility.safeInt(-(tEU * 100 / GregTech_API.mRFtoEU)));
+ }
+ } else {
+ if (storedRF > extractRF) {
+ ((IPowerContainer) tTileEntity).setEnergyStored(storedRF - extractRF);
+ tEU = maxEUInput();
+ } else {
+ ((IPowerContainer) tTileEntity).setEnergyStored(0);
+ tEU = storedRF * (long) GregTech_API.mRFtoEU / 100L;
+ }
+ }
+ aBaseMetaTileEntity.injectEnergyUnits((byte) 6, Math.min(tEU, maxEUInput()), 1);
+ }
}
}
}
@@ -270,10 +250,8 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi
@Override
public String getAlternativeModeText() {
- return (getBaseMetaTileEntity().isAllowedToWork()
- ? GT_Utility.trans("145", "Step Down, In: ")
- : GT_Utility.trans("146", "Step Up, In: "))
- + maxEUInput()
+ return (getBaseMetaTileEntity().isAllowedToWork() ? GT_Utility.trans("145", "Step Down, In: ")
+ : GT_Utility.trans("146", "Step Up, In: ")) + maxEUInput()
+ GT_Utility.trans("148", "V ")
+ maxAmperesIn()
+ GT_Utility.trans("147", "A, Out: ")
@@ -289,8 +267,8 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi
}
@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 int facing = getBaseMetaTileEntity().getFrontFacing();
final NBTTagCompound tag = accessor.getNBTData();
final int side = (byte) accessor.getSide().ordinal();
@@ -299,40 +277,43 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi
final byte inputTier = GT_Utility.getTier(tag.getLong("maxEUInput"));
final byte outputTier = GT_Utility.getTier(tag.getLong("maxEUOutput"));
- currenttip.add(String.format(
- "%s %s(%dA) -> %s(%dA)",
- (allowedToWork ? (GREEN + "Step Down") : (RED + "Step Up")) + RESET,
- GT_Mod.gregtechproxy.mWailaTransformerVoltageTier
- ? GT_Utility.getColoredTierNameFromTier(inputTier)
- : tag.getLong("maxEUInput"),
- tag.getLong("maxAmperesIn"),
- GT_Mod.gregtechproxy.mWailaTransformerVoltageTier
- ? GT_Utility.getColoredTierNameFromTier(outputTier)
- : tag.getLong("maxEUOutput"),
- tag.getLong("maxAmperesOut")));
+ currenttip.add(
+ String.format(
+ "%s %s(%dA) -> %s(%dA)",
+ (allowedToWork ? (GREEN + "Step Down") : (RED + "Step Up")) + RESET,
+ GT_Mod.gregtechproxy.mWailaTransformerVoltageTier
+ ? GT_Utility.getColoredTierNameFromTier(inputTier)
+ : tag.getLong("maxEUInput"),
+ tag.getLong("maxAmperesIn"),
+ GT_Mod.gregtechproxy.mWailaTransformerVoltageTier
+ ? GT_Utility.getColoredTierNameFromTier(outputTier)
+ : tag.getLong("maxEUOutput"),
+ tag.getLong("maxAmperesOut")));
if ((side == facing && allowedToWork) || (side != facing && !allowedToWork)) {
- currenttip.add(String.format(
- GOLD + "Input:" + RESET + " %s(%dA)",
- GT_Mod.gregtechproxy.mWailaTransformerVoltageTier
- ? GT_Utility.getColoredTierNameFromTier(inputTier)
- : tag.getLong("maxEUInput"),
- tag.getLong("maxAmperesIn")));
+ currenttip.add(
+ String.format(
+ GOLD + "Input:" + RESET + " %s(%dA)",
+ GT_Mod.gregtechproxy.mWailaTransformerVoltageTier
+ ? GT_Utility.getColoredTierNameFromTier(inputTier)
+ : tag.getLong("maxEUInput"),
+ tag.getLong("maxAmperesIn")));
} else {
- currenttip.add(String.format(
- BLUE + "Output:" + RESET + " %s(%dA)",
- GT_Mod.gregtechproxy.mWailaTransformerVoltageTier
- ? GT_Utility.getColoredTierNameFromTier(outputTier)
- : tag.getLong("maxEUOutput"),
- tag.getLong("maxAmperesOut")));
+ currenttip.add(
+ String.format(
+ BLUE + "Output:" + RESET + " %s(%dA)",
+ GT_Mod.gregtechproxy.mWailaTransformerVoltageTier
+ ? GT_Utility.getColoredTierNameFromTier(outputTier)
+ : tag.getLong("maxEUOutput"),
+ tag.getLong("maxAmperesOut")));
}
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("isAllowedToWork", getBaseMetaTileEntity().isAllowedToWork());
tag.setLong("maxEUInput", maxEUInput());
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Wireless_Dynamo.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Wireless_Dynamo.java
index 41b898b582..997898a34e 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Wireless_Dynamo.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Wireless_Dynamo.java
@@ -2,15 +2,16 @@ package gregtech.api.metatileentity.implementations;
import static gregtech.api.enums.GT_Values.*;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.IGlobalWirelessEnergy;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.interfaces.tileentity.IWirelessEnergyHatchInformation;
import gregtech.api.metatileentity.MetaTileEntity;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
public class GT_MetaTileEntity_Wireless_Dynamo extends GT_MetaTileEntity_Hatch_Dynamo
implements IGlobalWirelessEnergy, IWirelessEnergyHatchInformation {
@@ -18,23 +19,23 @@ public class GT_MetaTileEntity_Wireless_Dynamo extends GT_MetaTileEntity_Hatch_D
private String owner_uuid;
private String owner_name;
- public GT_MetaTileEntity_Wireless_Dynamo(
- String aName, byte aTier, String[] aDescription, ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_Wireless_Dynamo(String aName, byte aTier, String[] aDescription,
+ ITexture[][][] aTextures) {
super(aName, aTier, aDescription, aTextures);
}
public GT_MetaTileEntity_Wireless_Dynamo(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, new String[] {""});
+ super(aID, aName, aNameRegional, aTier, new String[] { "" });
}
@Override
public ITexture[] getTexturesActive(ITexture aBaseTexture) {
- return new ITexture[] {aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI_WIRELESS_ON[mTier]};
+ return new ITexture[] { aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI_WIRELESS_ON[mTier] };
}
@Override
public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
- return new ITexture[] {aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI_WIRELESS_ON[mTier]};
+ return new ITexture[] { aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI_WIRELESS_ON[mTier] };
}
@Override
@@ -84,11 +85,9 @@ public class GT_MetaTileEntity_Wireless_Dynamo extends GT_MetaTileEntity_Hatch_D
@Override
public String[] getDescription() {
- return new String[] {
- EnumChatFormatting.GRAY + "Stores energy globally in a network, up to 2^(2^31) EU.",
- EnumChatFormatting.GRAY + "Does not connect to wires. This block accepts EU into the network.",
- AuthorColen
- };
+ return new String[] { EnumChatFormatting.GRAY + "Stores energy globally in a network, up to 2^(2^31) EU.",
+ EnumChatFormatting.GRAY + "Does not connect to wires. This block accepts EU into the network.",
+ AuthorColen };
}
@Override
@@ -103,7 +102,7 @@ public class GT_MetaTileEntity_Wireless_Dynamo extends GT_MetaTileEntity_Hatch_D
@Override
public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GT_MetaTileEntity_Wireless_Dynamo(mName, mTier, new String[] {""}, mTextures);
+ return new GT_MetaTileEntity_Wireless_Dynamo(mName, mTier, new String[] { "" }, mTextures);
}
@Override
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Wireless_Hatch.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Wireless_Hatch.java
index 218f15c8c0..756a1b138a 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Wireless_Hatch.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Wireless_Hatch.java
@@ -2,22 +2,24 @@ package gregtech.api.metatileentity.implementations;
import static gregtech.api.enums.GT_Values.*;
+import java.math.BigInteger;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.IGlobalWirelessEnergy;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.interfaces.tileentity.IWirelessEnergyHatchInformation;
import gregtech.api.metatileentity.MetaTileEntity;
-import java.math.BigInteger;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
public class GT_MetaTileEntity_Wireless_Hatch extends GT_MetaTileEntity_Hatch_Energy
implements IGlobalWirelessEnergy, IWirelessEnergyHatchInformation {
- private final BigInteger eu_transferred_per_operation =
- BigInteger.valueOf(2 * V[mTier] * ticks_between_energy_addition);
+ private final BigInteger eu_transferred_per_operation = BigInteger
+ .valueOf(2 * V[mTier] * ticks_between_energy_addition);
private final long eu_transferred_per_operation_long = eu_transferred_per_operation.longValue();
private String owner_uuid;
@@ -28,26 +30,24 @@ public class GT_MetaTileEntity_Wireless_Hatch extends GT_MetaTileEntity_Hatch_En
}
public GT_MetaTileEntity_Wireless_Hatch(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, new String[] {""});
+ super(aID, aName, aNameRegional, aTier, new String[] { "" });
}
@Override
public String[] getDescription() {
- return new String[] {
- EnumChatFormatting.GRAY + "Stores energy globally in a network, up to 2^(2^31) EU.",
- EnumChatFormatting.GRAY + "Does not connect to wires. This block withdraws EU from the network.",
- AuthorColen
- };
+ return new String[] { EnumChatFormatting.GRAY + "Stores energy globally in a network, up to 2^(2^31) EU.",
+ EnumChatFormatting.GRAY + "Does not connect to wires. This block withdraws EU from the network.",
+ AuthorColen };
}
@Override
public ITexture[] getTexturesActive(ITexture aBaseTexture) {
- return new ITexture[] {aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI_WIRELESS_ON[mTier]};
+ return new ITexture[] { aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI_WIRELESS_ON[mTier] };
}
@Override
public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
- return new ITexture[] {aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI_WIRELESS_ON[mTier]};
+ return new ITexture[] { aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI_WIRELESS_ON[mTier] };
}
@Override
@@ -107,7 +107,7 @@ public class GT_MetaTileEntity_Wireless_Hatch extends GT_MetaTileEntity_Hatch_En
@Override
public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GT_MetaTileEntity_Wireless_Hatch(mName, mTier, new String[] {""}, mTextures);
+ return new GT_MetaTileEntity_Wireless_Hatch(mName, mTier, new String[] { "" }, mTextures);
}
@Override