aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gradle.properties6
-rw-r--r--src/main/java/net/glease/ggfab/BlockIcons.java10
-rw-r--r--src/main/java/net/glease/ggfab/ComponentRecipeLoader.java42
-rw-r--r--src/main/java/net/glease/ggfab/ConfigurationHandler.java15
-rw-r--r--src/main/java/net/glease/ggfab/GGConstants.java3
-rw-r--r--src/main/java/net/glease/ggfab/GGItemList.java15
-rw-r--r--src/main/java/net/glease/ggfab/GigaGramFab.java29
-rw-r--r--src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java361
-rw-r--r--src/main/java/net/glease/ggfab/mte/MTE_LinkedInputBus.java194
-rw-r--r--src/main/java/net/glease/ggfab/nei/IMCForNEI.java3
-rw-r--r--src/main/java/net/glease/ggfab/util/GGUtils.java23
-rw-r--r--src/main/java/net/glease/ggfab/util/OverclockHelper.java5
-rw-r--r--src/test/java/net/glease/ggfab/util/OverclockHelperTest.java22
13 files changed, 362 insertions, 366 deletions
diff --git a/gradle.properties b/gradle.properties
index 2ba431d3a7..7fea7b33f2 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -53,7 +53,9 @@ mixinsPackage =
coreModClass =
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
-containsMixinsAndOrCoreModOnly = true
+containsMixinsAndOrCoreModOnly = false
+
+# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
forceEnableMixins = true
# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your
@@ -63,4 +65,4 @@ usesShadowedDependencies = false
# Uncomment this to disable spotless checks
# This should only be uncommented to keep it easier to sync with upstream/other forks.
# That is, if there is no other active fork/upstream, NEVER change this.
-disableSpotless = true
+#disableSpotless = true
diff --git a/src/main/java/net/glease/ggfab/BlockIcons.java b/src/main/java/net/glease/ggfab/BlockIcons.java
index 7e1cfe43ef..638b206f44 100644
--- a/src/main/java/net/glease/ggfab/BlockIcons.java
+++ b/src/main/java/net/glease/ggfab/BlockIcons.java
@@ -1,19 +1,21 @@
package net.glease.ggfab;
-import gregtech.api.GregTech_API;
-import gregtech.api.interfaces.IIconContainer;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
+import gregtech.api.GregTech_API;
+import gregtech.api.interfaces.IIconContainer;
+
public enum BlockIcons implements IIconContainer, Runnable {
+
OVERLAY_FRONT_ADV_ASSLINE_ACTIVE,
OVERLAY_FRONT_ADV_ASSLINE_ACTIVE_GLOW,
OVERLAY_FRONT_ADV_ASSLINE_STUCK,
OVERLAY_FRONT_ADV_ASSLINE_STUCK_GLOW,
OVERLAY_FRONT_ADV_ASSLINE,
- OVERLAY_FRONT_ADV_ASSLINE_GLOW,
- ;
+ OVERLAY_FRONT_ADV_ASSLINE_GLOW,;
+
public static final String RES_PATH = GGConstants.MODID + ":";
private IIcon mIcon;
diff --git a/src/main/java/net/glease/ggfab/ComponentRecipeLoader.java b/src/main/java/net/glease/ggfab/ComponentRecipeLoader.java
index 6cf35d97a6..088ad86025 100644
--- a/src/main/java/net/glease/ggfab/ComponentRecipeLoader.java
+++ b/src/main/java/net/glease/ggfab/ComponentRecipeLoader.java
@@ -1,19 +1,21 @@
package net.glease.ggfab;
+import static gregtech.api.enums.GT_Values.RA;
+
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidRegistry;
+import net.minecraftforge.fluids.FluidStack;
+
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
-import net.minecraft.item.ItemStack;
-import net.minecraftforge.fluids.Fluid;
-import net.minecraftforge.fluids.FluidRegistry;
-import net.minecraftforge.fluids.FluidStack;
-
-import static gregtech.api.enums.GT_Values.RA;
class ComponentRecipeLoader implements Runnable {
+
@Override
public void run() {
Fluid solderIndalloy = FluidRegistry.getFluid("molten.indalloy140") != null
@@ -22,28 +24,20 @@ class ComponentRecipeLoader implements Runnable {
RA.addAssemblylineRecipe(
ItemList.Machine_Multi_Assemblyline.get(1L),
96000,
- new Object[]{
- ItemList.Machine_Multi_Assemblyline.get(1L),
- new Object[]{OrePrefixes.circuit.get(Materials.Master), 2},
- new Object[]{OrePrefixes.circuit.get(Materials.Elite), 4},
- new Object[]{OrePrefixes.circuit.get(Materials.Data), 8},
- ItemList.Automation_ChestBuffer_LuV.get(1L),
- },
- new FluidStack[]{
- new FluidStack(solderIndalloy, 1296),
- Materials.Lubricant.getFluid(2000)
- },
+ new Object[] { ItemList.Machine_Multi_Assemblyline.get(1L),
+ new Object[] { OrePrefixes.circuit.get(Materials.Master), 2 },
+ new Object[] { OrePrefixes.circuit.get(Materials.Elite), 4 },
+ new Object[] { OrePrefixes.circuit.get(Materials.Data), 8 },
+ ItemList.Automation_ChestBuffer_LuV.get(1L), },
+ new FluidStack[] { new FluidStack(solderIndalloy, 1296), Materials.Lubricant.getFluid(2000) },
GGItemList.AdvAssLine.get(1L),
1200,
- 6000
- );
- RA.addAssemblerRecipe(new ItemStack[]{
- ItemList.Hatch_Input_Bus_IV.get(1L),
- ItemList.Emitter_IV.get(1L),
+ 6000);
+ RA.addAssemblerRecipe(
+ new ItemStack[] { ItemList.Hatch_Input_Bus_IV.get(1L), ItemList.Emitter_IV.get(1L),
ItemList.Sensor_IV.get(1L),
GT_OreDictUnificator.get(OrePrefixes.plateDense, Materials.Enderium, 1L),
- GT_Utility.getIntegratedCircuit(12),
- },
+ GT_Utility.getIntegratedCircuit(12), },
Materials.Polybenzimidazole.getMolten(144L),
GGItemList.LinkedInputBus.get(1L),
600,
diff --git a/src/main/java/net/glease/ggfab/ConfigurationHandler.java b/src/main/java/net/glease/ggfab/ConfigurationHandler.java
index 812b6cbedc..249bb16da8 100644
--- a/src/main/java/net/glease/ggfab/ConfigurationHandler.java
+++ b/src/main/java/net/glease/ggfab/ConfigurationHandler.java
@@ -1,13 +1,14 @@
package net.glease.ggfab;
+import java.io.File;
+import java.util.Map;
+
import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
-import java.io.File;
-import java.util.Map;
-
public enum ConfigurationHandler {
+
INSTANCE;
private Configuration config;
@@ -30,7 +31,13 @@ public enum ConfigurationHandler {
}
private void loadConfig() {
- laserOCPenaltyFactor = config.getFloat("advasslinePenaltyFactor", "common.balancing", 0.3f, 0f, 10f, "Laser overclock penalty factor. This will incredibly change the game balance. Even a small step from 0.2 to 0.3 can have very significant impact. Tweak with caution!");
+ laserOCPenaltyFactor = config.getFloat(
+ "advasslinePenaltyFactor",
+ "common.balancing",
+ 0.3f,
+ 0f,
+ 10f,
+ "Laser overclock penalty factor. This will incredibly change the game balance. Even a small step from 0.2 to 0.3 can have very significant impact. Tweak with caution!");
config.save();
}
diff --git a/src/main/java/net/glease/ggfab/GGConstants.java b/src/main/java/net/glease/ggfab/GGConstants.java
index ef8027bf92..6e8b4a048f 100644
--- a/src/main/java/net/glease/ggfab/GGConstants.java
+++ b/src/main/java/net/glease/ggfab/GGConstants.java
@@ -3,10 +3,11 @@ package net.glease.ggfab;
import net.minecraft.util.EnumChatFormatting;
public class GGConstants {
+
public static final String MODID = "ggfab";
public static final String MODNAME = "GigaGramFab";
public static final String VERSION = "GRADLETOKEN_VERSION";
public static final String GGMARK = EnumChatFormatting.GOLD + "GigaGram" + EnumChatFormatting.RESET + "Fab";
- public static final String GGMARK_TOOLTIP = "Added by "+ GGMARK;
+ public static final String GGMARK_TOOLTIP = "Added by " + GGMARK;
}
diff --git a/src/main/java/net/glease/ggfab/GGItemList.java b/src/main/java/net/glease/ggfab/GGItemList.java
index b54f5d6406..6363f90983 100644
--- a/src/main/java/net/glease/ggfab/GGItemList.java
+++ b/src/main/java/net/glease/ggfab/GGItemList.java
@@ -1,19 +1,20 @@
package net.glease.ggfab;
+import static gregtech.api.enums.GT_Values.W;
+
+import net.minecraft.block.Block;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+
import gregtech.api.interfaces.IItemContainer;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
-import net.minecraft.block.Block;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import static gregtech.api.enums.GT_Values.W;
+public enum GGItemList implements IItemContainer {
-public enum GGItemList implements IItemContainer{
LinkedInputBus,
- AdvAssLine,
- ;
+ AdvAssLine,;
private ItemStack mStack;
private boolean mHasNotBeenSet = true;
diff --git a/src/main/java/net/glease/ggfab/GigaGramFab.java b/src/main/java/net/glease/ggfab/GigaGramFab.java
index b05703ef2e..08f5cc9d2b 100644
--- a/src/main/java/net/glease/ggfab/GigaGramFab.java
+++ b/src/main/java/net/glease/ggfab/GigaGramFab.java
@@ -1,25 +1,35 @@
package net.glease.ggfab;
-import cpw.mods.fml.common.Mod;
-import cpw.mods.fml.common.event.*;
-import gregtech.api.GregTech_API;
import net.glease.ggfab.mte.MTE_AdvAssLine;
import net.glease.ggfab.mte.MTE_LinkedInputBus;
import net.glease.ggfab.nei.IMCForNEI;
-@Mod(modid = GGConstants.MODID, version = GGConstants.VERSION, name = GGConstants.MODNAME, acceptedMinecraftVersions = "[1.7.10]", dependencies = "required-after:IC2;required-before:gregtech")
+import cpw.mods.fml.common.Mod;
+import cpw.mods.fml.common.event.*;
+import gregtech.api.GregTech_API;
+
+@Mod(
+ modid = GGConstants.MODID,
+ version = GGConstants.VERSION,
+ name = GGConstants.MODNAME,
+ acceptedMinecraftVersions = "[1.7.10]",
+ dependencies = "required-after:IC2;required-before:gregtech")
public class GigaGramFab {
+
public GigaGramFab() {
// initialize the textures
- //noinspection ResultOfMethodCallIgnored
+ // noinspection ResultOfMethodCallIgnored
BlockIcons.OVERLAY_FRONT_ADV_ASSLINE.name();
}
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
GregTech_API.sAfterGTPreload.add(() -> {
- GGItemList.AdvAssLine.set(new MTE_AdvAssLine(13532, "ggfab.machine.adv_assline", "Advanced Assembly Line").getStackForm(1));
- GGItemList.LinkedInputBus.set(new MTE_LinkedInputBus(13533, "ggfab.machine.linked_input_bus", "Linked Input Bus", 5).getStackForm(1));
+ GGItemList.AdvAssLine.set(
+ new MTE_AdvAssLine(13532, "ggfab.machine.adv_assline", "Advanced Assembly Line").getStackForm(1));
+ GGItemList.LinkedInputBus.set(
+ new MTE_LinkedInputBus(13533, "ggfab.machine.linked_input_bus", "Linked Input Bus", 5)
+ .getStackForm(1));
});
GregTech_API.sBeforeGTPostload.add(new ComponentRecipeLoader());
ConfigurationHandler.INSTANCE.init(event.getSuggestedConfigurationFile());
@@ -31,7 +41,6 @@ public class GigaGramFab {
}
@Mod.EventHandler
- public void postInit(FMLPostInitializationEvent event) {
- }
+ public void postInit(FMLPostInitializationEvent event) {}
-} \ No newline at end of file
+}
diff --git a/src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java b/src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java
index 1fa00f6532..c4eafa7fad 100644
--- a/src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java
+++ b/src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java
@@ -1,21 +1,17 @@
package net.glease.ggfab.mte;
-import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable;
-import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
-import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment;
-import com.gtnewhorizon.structurelib.structure.StructureDefinition;
-import gregtech.api.GregTech_API;
-import gregtech.api.enums.GT_Values;
-import gregtech.api.enums.ItemList;
-import gregtech.api.interfaces.IHatchElement;
-import gregtech.api.interfaces.ITexture;
-import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.implementations.*;
-import gregtech.api.render.TextureFactory;
-import gregtech.api.util.*;
-import mcp.mobius.waila.api.IWailaConfigHandler;
-import mcp.mobius.waila.api.IWailaDataAccessor;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static gregtech.GT_Mod.GT_FML_LOGGER;
+import static gregtech.api.enums.GT_HatchElement.*;
+import static gregtech.api.enums.GT_Values.V;
+import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages;
+import static gregtech.api.util.GT_StructureUtility.buildHatchAdder;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+import static net.glease.ggfab.BlockIcons.*;
+
+import java.util.*;
+import java.util.stream.IntStream;
+
import net.glease.ggfab.ConfigurationHandler;
import net.glease.ggfab.GGConstants;
import net.glease.ggfab.util.OverclockHelper;
@@ -33,92 +29,87 @@ import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
-import java.util.*;
-import java.util.stream.IntStream;
+import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable;
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
-import static gregtech.GT_Mod.GT_FML_LOGGER;
-import static gregtech.api.enums.GT_HatchElement.*;
-import static gregtech.api.enums.GT_Values.V;
-import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages;
-import static gregtech.api.util.GT_StructureUtility.buildHatchAdder;
-import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-import static net.glease.ggfab.BlockIcons.*;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.ItemList;
+import gregtech.api.interfaces.IHatchElement;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.render.TextureFactory;
+import gregtech.api.util.*;
+import mcp.mobius.waila.api.IWailaConfigHandler;
+import mcp.mobius.waila.api.IWailaDataAccessor;
/*
-Dev note:
-1. This multi will be an assline but with greater throughput. it will take one input every
-2.
+ * Dev note: 1. This multi will be an assline but with greater throughput. it will take one input every 2.
*/
-public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBase<MTE_AdvAssLine> implements ISurvivalConstructable {
+public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBase<MTE_AdvAssLine>
+ implements ISurvivalConstructable {
+
private static final String STRUCTURE_PIECE_FIRST = "first";
private static final String STRUCTURE_PIECE_LATER = "later";
private static final String STRUCTURE_PIECE_LAST = "last";
public static final String TAG_KEY_CURRENT_STICK = "mCurrentStick";
public static final String TAG_KEY_PROGRESS_TIMES = "mProgressTimeArray";
- private static final IStructureDefinition<MTE_AdvAssLine> STRUCTURE_DEFINITION =
- StructureDefinition.<MTE_AdvAssLine>builder()
- .addShape(STRUCTURE_PIECE_FIRST, transpose(new String[][]{
- {" ", "e", " "},
- {"~", "l", "G"},
- {"g", "m", "g"},
- {"b", "i", "b"},
- }))
- .addShape(STRUCTURE_PIECE_LATER, transpose(new String[][]{
- {" ", "e", " "},
- {"d", "l", "d"},
- {"g", "m", "g"},
- {"b", "I", "b"},
- }))
- .addShape(STRUCTURE_PIECE_LAST, transpose(new String[][]{
- {" ", "e", " "},
- {"d", "l", "d"},
- {"g", "m", "g"},
- {"o", "i", "b"},
- }))
- .addElement('G', ofBlock(GregTech_API.sBlockCasings3, 10)) // grate machine casing
- .addElement('l', ofBlock(GregTech_API.sBlockCasings2, 9)) // assembler machine casing
- .addElement('m', ofBlock(GregTech_API.sBlockCasings2, 5)) // assembling line casing
- .addElement(
- 'g',
- ofChain(
- ofBlockUnlocalizedName("IC2", "blockAlloyGlass", 0, true),
- ofBlockUnlocalizedName("bartworks", "BW_GlasBlocks", 0, true),
- // warded glass
- ofBlockUnlocalizedName("Thaumcraft", "blockCosmeticOpaque", 2, false)))
- .addElement(
- 'e',
- ofChain(
- Energy.or(ExoticEnergy).newAny(16, 1, ForgeDirection.UP, ForgeDirection.NORTH, ForgeDirection.SOUTH),
- ofBlock(GregTech_API.sBlockCasings2, 0)))
- .addElement(
- 'd',
- buildHatchAdder(MTE_AdvAssLine.class)
- .atLeast(DataHatchElement.DataAccess)
- .dot(2)
- .casingIndex(42)
- .allowOnly(ForgeDirection.NORTH)
- .buildAndChain(GregTech_API.sBlockCasings3, 10))
- .addElement(
- 'b',
- buildHatchAdder(MTE_AdvAssLine.class)
- .atLeast(InputHatch, InputHatch, InputHatch, InputHatch, Maintenance)
- .casingIndex(16)
- .dot(3)
- .allowOnly(ForgeDirection.DOWN)
- .buildAndChain(
- ofBlock(GregTech_API.sBlockCasings2, 0),
- ofHatchAdder(
- MTE_AdvAssLine::addOutputToMachineList, 16, 4)))
- .addElement(
- 'I',
- ofChain(
- // all blocks nearby use solid steel casing, so let's use the texture of that
- InputBus.newAny(16, 5, ForgeDirection.DOWN),
+ private static final IStructureDefinition<MTE_AdvAssLine> STRUCTURE_DEFINITION = StructureDefinition
+ .<MTE_AdvAssLine>builder()
+ .addShape(
+ STRUCTURE_PIECE_FIRST,
+ transpose(
+ new String[][] { { " ", "e", " " }, { "~", "l", "G" }, { "g", "m", "g" },
+ { "b", "i", "b" }, }))
+ .addShape(
+ STRUCTURE_PIECE_LATER,
+ transpose(
+ new String[][] { { " ", "e", " " }, { "d", "l", "d" }, { "g", "m", "g" },
+ { "b", "I", "b" }, }))
+ .addShape(
+ STRUCTURE_PIECE_LAST,
+ transpose(
+ new String[][] { { " ", "e", " " }, { "d", "l", "d" }, { "g", "m", "g" },
+ { "o", "i", "b" }, }))
+ .addElement('G', ofBlock(GregTech_API.sBlockCasings3, 10)) // grate machine casing
+ .addElement('l', ofBlock(GregTech_API.sBlockCasings2, 9)) // assembler machine casing
+ .addElement('m', ofBlock(GregTech_API.sBlockCasings2, 5)) // assembling line casing
+ .addElement(
+ 'g',
+ ofChain(
+ ofBlockUnlocalizedName("IC2", "blockAlloyGlass", 0, true),
+ ofBlockUnlocalizedName("bartworks", "BW_GlasBlocks", 0, true),
+ // warded glass
+ ofBlockUnlocalizedName("Thaumcraft", "blockCosmeticOpaque", 2, false)))
+ .addElement(
+ 'e',
+ ofChain(
+ Energy.or(ExoticEnergy)
+ .newAny(16, 1, ForgeDirection.UP, ForgeDirection.NORTH, ForgeDirection.SOUTH),
+ ofBlock(GregTech_API.sBlockCasings2, 0)))
+ .addElement(
+ 'd',
+ buildHatchAdder(MTE_AdvAssLine.class).atLeast(DataHatchElement.DataAccess).dot(2).casingIndex(42)
+ .allowOnly(ForgeDirection.NORTH).buildAndChain(GregTech_API.sBlockCasings3, 10))
+ .addElement(
+ 'b',
+ buildHatchAdder(MTE_AdvAssLine.class)
+ .atLeast(InputHatch, InputHatch, InputHatch, InputHatch, Maintenance).casingIndex(16).dot(3)
+ .allowOnly(ForgeDirection.DOWN).buildAndChain(
+ ofBlock(GregTech_API.sBlockCasings2, 0),
ofHatchAdder(MTE_AdvAssLine::addOutputToMachineList, 16, 4)))
- .addElement('i', InputBus.newAny(16, 5, ForgeDirection.DOWN))
- .addElement('o', OutputBus.newAny(16, 4, ForgeDirection.DOWN))
- .build();
+ .addElement(
+ 'I',
+ ofChain(
+ // all blocks nearby use solid steel casing, so let's use the texture of that
+ InputBus.newAny(16, 5, ForgeDirection.DOWN),
+ ofHatchAdder(MTE_AdvAssLine::addOutputToMachineList, 16, 4)))
+ .addElement('i', InputBus.newAny(16, 5, ForgeDirection.DOWN))
+ .addElement('o', OutputBus.newAny(16, 4, ForgeDirection.DOWN)).build();
private ItemStack currentStick;
private GT_Recipe.GT_Recipe_AssemblyLine currentRecipe;
private final Slice[] slices = IntStream.range(0, 16).mapToObj(Slice::new).toArray(Slice[]::new);
@@ -164,7 +155,8 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas
for (int i = 1; i < 16; i++) {
if (!checkPiece(STRUCTURE_PIECE_LATER, leftToRight ? -i : i, 1, 0)) return false;
if (!mOutputBusses.isEmpty())
- return (!mEnergyHatches.isEmpty() || !mExoticEnergyHatches.isEmpty()) && mMaintenanceHatches.size() == 1 && mDataAccessHatches.size() <= 1;
+ return (!mEnergyHatches.isEmpty() || !mExoticEnergyHatches.isEmpty()) && mMaintenanceHatches.size() == 1
+ && mDataAccessHatches.size() <= 1;
}
return false;
}
@@ -197,13 +189,11 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas
// blockrenderer6343 seems to place the block in a weird way, let's catch that
if (getBaseMetaTileEntity() != null && getBaseMetaTileEntity().isServerSide()) {
UUID ownerUuid = getBaseMetaTileEntity().getOwnerUuid();
- if (ownerUuid == null)
- return;
+ if (ownerUuid == null) return;
float factor = ConfigurationHandler.INSTANCE.getLaserOCPenaltyFactor();
MinecraftServer server = MinecraftServer.getServer();
// more blockrenderer6343 weirdness
- if (server == null)
- return;
+ if (server == null) return;
@SuppressWarnings("unchecked")
List<EntityPlayerMP> l = server.getConfigurationManager().playerEntityList;
for (EntityPlayerMP p : l) {
@@ -213,10 +203,12 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas
Object[] args;
switch (i) {
case 7:
- args = new Object[]{factor};
+ args = new Object[] { factor };
break;
case 8:
- args = new Object[]{(int) (factor * 100) + 400, (int) ((4 + factor) * (4 + factor + factor) * 100), 4 + factor, 4 + factor + factor};
+ args = new Object[] { (int) (factor * 100) + 400,
+ (int) ((4 + factor) * (4 + factor + factor) * 100), 4 + factor,
+ 4 + factor + factor };
break;
default:
args = new Object[0];
@@ -229,63 +221,35 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas
}
@Override
- public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing, int colorIndex, boolean aActive, boolean aRedstone) {
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing,
+ int colorIndex, boolean aActive, boolean aRedstone) {
if (side == facing) {
if (stuck) {
- return new ITexture[]{
- casingTexturePages[0][16],
- TextureFactory.builder()
- .addIcon(OVERLAY_FRONT_ADV_ASSLINE_STUCK)
- .extFacing()
- .build(),
- TextureFactory.builder()
- .addIcon(OVERLAY_FRONT_ADV_ASSLINE_STUCK_GLOW)
- .extFacing()
- .glow()
- .build()
- };
+ return new ITexture[] { casingTexturePages[0][16],
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_ADV_ASSLINE_STUCK).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_ADV_ASSLINE_STUCK_GLOW).extFacing().glow()
+ .build() };
}
- if (aActive)
- return new ITexture[]{
- casingTexturePages[0][16],
- TextureFactory.builder()
- .addIcon(OVERLAY_FRONT_ADV_ASSLINE_ACTIVE)
- .extFacing()
- .build(),
- TextureFactory.builder()
- .addIcon(OVERLAY_FRONT_ADV_ASSLINE_ACTIVE_GLOW)
- .extFacing()
- .glow()
- .build()
- };
- return new ITexture[]{
- casingTexturePages[0][16],
- TextureFactory.builder()
- .addIcon(OVERLAY_FRONT_ADV_ASSLINE)
- .extFacing()
- .build(),
- TextureFactory.builder()
- .addIcon(OVERLAY_FRONT_ADV_ASSLINE_GLOW)
- .extFacing()
- .glow()
- .build()
- };
- }
- return new ITexture[]{casingTexturePages[0][16]};
+ if (aActive) return new ITexture[] { casingTexturePages[0][16],
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_ADV_ASSLINE_ACTIVE).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_ADV_ASSLINE_ACTIVE_GLOW).extFacing().glow()
+ .build() };
+ return new ITexture[] { casingTexturePages[0][16],
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_ADV_ASSLINE).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_ADV_ASSLINE_GLOW).extFacing().glow().build() };
+ }
+ return new ITexture[] { casingTexturePages[0][16] };
}
@Override
protected GT_Multiblock_Tooltip_Builder createTooltip() {
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
- tt.addMachineType("Assembling Line")
- .addInfo("Controller block for the Advanced Assembling Line")
+ tt.addMachineType("Assembling Line").addInfo("Controller block for the Advanced Assembling Line")
.addInfo("Built exactly the same as standard Assembling Line")
.addInfo("Place in world to get more info. It will be a lengthy read.")
- .addInfo("Assembling Line with item pipelining")
- .addInfo("All fluids are however consumed at start")
+ .addInfo("Assembling Line with item pipelining").addInfo("All fluids are however consumed at start")
.addInfo("Use voltage of worst energy hatch for overclocking")
- .addInfo("EU/t is (number of slices working) * (overclocked EU/t)")
- .addSeparator()
+ .addInfo("EU/t is (number of slices working) * (overclocked EU/t)").addSeparator()
.beginVariableStructureBlock(5, 16, 4, 4, 3, 3, false)
.addStructureInfo("From Bottom to Top, Left to Right")
.addStructureInfo(
@@ -295,10 +259,8 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas
.addStructureInfo("Layer 3 - Grate Machine Casing, Assembler Machine Casing, Grate Machine Casing")
.addStructureInfo("Layer 4 - Empty, Solid Steel Machine Casing, Empty")
.addStructureInfo("Up to 16 repeating slices, each one allows for 1 more item in recipes")
- .addController("Either Grate on layer 3 of the first slice")
- .addEnergyHatch("Any layer 4 casing", 1)
- .addMaintenanceHatch("Any layer 1 casing", 3)
- .addInputBus("As specified on layer 1", 4, 5)
+ .addController("Either Grate on layer 3 of the first slice").addEnergyHatch("Any layer 4 casing", 1)
+ .addMaintenanceHatch("Any layer 1 casing", 3).addInputBus("As specified on layer 1", 4, 5)
.addInputHatch("Any layer 1 casing", 3)
.addOutputBus("Replaces Input Bus on final slice or on any solid steel casing on layer 1", 4)
.addOtherStructurePart("Data Access Hatch", "Optional, next to controller", 2)
@@ -332,7 +294,9 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas
if (getBaseMetaTileEntity().isActive() && GT_Utility.isStackValid(currentStick)) {
aNBT.setTag(TAG_KEY_CURRENT_STICK, currentStick.writeToNBT(new NBTTagCompound()));
aNBT.setInteger("mRecipeHash", currentRecipe.getPersistentHash());
- aNBT.setIntArray(TAG_KEY_PROGRESS_TIMES, Arrays.stream(slices).limit(currentRecipe.mInputs.length).mapToInt(s -> s.progress).toArray());
+ aNBT.setIntArray(
+ TAG_KEY_PROGRESS_TIMES,
+ Arrays.stream(slices).limit(currentRecipe.mInputs.length).mapToInt(s -> s.progress).toArray());
aNBT.setBoolean("stuck", stuck);
aNBT.setLong("inputV", inputVoltage);
aNBT.setLong("inputEU", inputEUt);
@@ -353,13 +317,13 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas
if (arr[i] == 0)
// this will be synced to client by first MTE packet to client
stuck = true;
- } else
- slices[i].reset();
+ } else slices[i].reset();
}
}
if (aNBT.hasKey(TAG_KEY_CURRENT_STICK, Constants.NBT.TAG_COMPOUND)) {
loadedStack = ItemStack.loadItemStackFromNBT(aNBT.getCompoundTag(TAG_KEY_CURRENT_STICK));
- GT_AssemblyLineUtils.LookupResult lookupResult = GT_AssemblyLineUtils.findAssemblyLineRecipeFromDataStick(loadedStack, false);
+ GT_AssemblyLineUtils.LookupResult lookupResult = GT_AssemblyLineUtils
+ .findAssemblyLineRecipeFromDataStick(loadedStack, false);
switch (lookupResult.getType()) {
case VALID_STACK_AND_VALID_HASH:
recipe = lookupResult.getRecipe();
@@ -417,12 +381,10 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas
}
private void recordEnergySupplier(GT_MetaTileEntity_Hatch hatch) {
- if (!isValidMetaTileEntity(hatch))
- return;
+ if (!isValidMetaTileEntity(hatch)) return;
inputEUt += hatch.maxEUInput() * hatch.maxWorkingAmperesIn();
inputVoltage = Math.min(inputVoltage, hatch.maxEUInput());
- if (inputEUt < 0)
- inputEUt = Long.MAX_VALUE;
+ if (inputEUt < 0) inputEUt = Long.MAX_VALUE;
}
@Override
@@ -435,8 +397,7 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas
@Override
protected void endRecipeProcessing() {
- if (!processing)
- return;
+ if (!processing) return;
super.endRecipeProcessing();
processing = false;
}
@@ -445,8 +406,7 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas
public void onValueUpdate(byte aValue) {
boolean oStuck = stuck;
stuck = (aValue & 1) == 1;
- if (oStuck != stuck)
- getBaseMetaTileEntity().issueTextureUpdate();
+ if (oStuck != stuck) getBaseMetaTileEntity().issueTextureUpdate();
}
@Override
@@ -488,8 +448,7 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas
mProgresstime = (slice.id + 1) * (mMaxProgresstime / currentRecipe.mInputs.length) - slice.progress;
}
}
- if (slice.progress > 0)
- working++;
+ if (slice.progress > 0) working++;
}
lEUt = working * baseEUt;
@@ -503,11 +462,9 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas
}
}
} else {
- if (!super.onRunningTick(aStack))
- return false;
+ if (!super.onRunningTick(aStack)) return false;
}
-
if (getBaseMetaTileEntity().isAllowedToWork()) {
if (hasAllFluids(currentRecipe) && slices[0].start()) {
drainAllFluids(currentRecipe);
@@ -520,8 +477,8 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas
}
private GT_Recipe.GT_Recipe_AssemblyLine findRecipe(ItemStack tDataStick) {
- GT_AssemblyLineUtils.LookupResult tLookupResult =
- GT_AssemblyLineUtils.findAssemblyLineRecipeFromDataStick(tDataStick, false);
+ GT_AssemblyLineUtils.LookupResult tLookupResult = GT_AssemblyLineUtils
+ .findAssemblyLineRecipeFromDataStick(tDataStick, false);
if (tLookupResult.getType() == GT_AssemblyLineUtils.LookupResultType.INVALID_STICK) return null;
@@ -541,8 +498,7 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas
// Check Inputs align
int aItemCount = tRecipe.mInputs.length;
- if (mInputBusses.size() < aItemCount)
- return null;
+ if (mInputBusses.size() < aItemCount) return null;
for (int i = 0; i < aItemCount; i++) {
GT_MetaTileEntity_Hatch_InputBus tInputBus = mInputBusses.get(i);
if (tInputBus == null) {
@@ -558,8 +514,7 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas
}
// Check Fluid Inputs align
- if (!hasAllFluids(tRecipe))
- return null;
+ if (!hasAllFluids(tRecipe)) return null;
if (GT_Values.D1) {
GT_FML_LOGGER.info("Check overclock");
@@ -572,8 +527,7 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas
private boolean hasAllFluids(GT_Recipe.GT_Recipe_AssemblyLine tRecipe) {
int aFluidCount = tRecipe.mFluidInputs.length;
- if (mInputHatches.size() < aFluidCount)
- return false;
+ if (mInputHatches.size() < aFluidCount) return false;
for (int i = 0; i < aFluidCount; i++) {
GT_MetaTileEntity_Hatch_Input tInputHatch = mInputHatches.get(i);
if (!isValidMetaTileEntity(tInputHatch)) {
@@ -645,16 +599,18 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas
// we use the new oc calculator instead
// calculateOverclockedNessMulti from super class has a mysterious 5% cable loss thing at the moment
// of writing
- GT_OverclockCalculator ocCalc = new GT_OverclockCalculator()
- .setRecipeEUt(currentRecipe.mEUt)
- .setDuration(Math.max(recipe.mDuration / recipe.mInputs.length, 1))
- .setEUt(inputVoltage);
+ GT_OverclockCalculator ocCalc = new GT_OverclockCalculator().setRecipeEUt(currentRecipe.mEUt)
+ .setDuration(Math.max(recipe.mDuration / recipe.mInputs.length, 1)).setEUt(inputVoltage);
// since we already checked mEUt <= inputVoltage, no need to check if recipe is too OP
lEUt = ocCalc.getConsumption();
mMaxProgresstime = ocCalc.getDuration();
// then laser overclock if needed
if (!mExoticEnergyHatches.isEmpty()) {
- OverclockHelper.OverclockOutput laserOverclock = OverclockHelper.laserOverclock(lEUt, mMaxProgresstime, inputEUt / recipe.mInputs.length, ConfigurationHandler.INSTANCE.getLaserOCPenaltyFactor());
+ OverclockHelper.OverclockOutput laserOverclock = OverclockHelper.laserOverclock(
+ lEUt,
+ mMaxProgresstime,
+ inputEUt / recipe.mInputs.length,
+ ConfigurationHandler.INSTANCE.getLaserOCPenaltyFactor());
if (laserOverclock != null) {
lEUt = laserOverclock.getEUt();
mMaxProgresstime = laserOverclock.getDuration();
@@ -684,7 +640,7 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas
}
drainAllFluids(recipe);
- mOutputItems = new ItemStack[]{recipe.mOutput};
+ mOutputItems = new ItemStack[] { recipe.mOutput };
if (this.lEUt > 0) {
this.lEUt = -this.lEUt;
@@ -726,17 +682,21 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas
}
@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) {
super.getWailaBody(itemStack, currentTip, accessor, config);
NBTTagCompound tag = accessor.getNBTData();
String machineProgressString = GT_Waila.getMachineProgressString(
- tag.getBoolean("isActive"), tag.getInteger("maxProgress"), tag.getInteger("progress"));
+ tag.getBoolean("isActive"),
+ tag.getInteger("maxProgress"),
+ tag.getInteger("progress"));
currentTip.remove(machineProgressString);
int duration = tag.getInteger("mDuration");
if (tag.hasKey(TAG_KEY_PROGRESS_TIMES, Constants.NBT.TAG_LIST)) {
NBTTagList tl = tag.getTagList(TAG_KEY_PROGRESS_TIMES, Constants.NBT.TAG_INT);
- @SuppressWarnings("unchecked") List<NBTTagInt> list = tl.tagList;
+ @SuppressWarnings("unchecked")
+ List<NBTTagInt> list = tl.tagList;
for (int i = 0, listSize = list.size(); i < listSize; i++) {
NBTTagInt t = list.get(i);
int progress = t.func_150287_d();
@@ -745,16 +705,23 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas
} else if (progress < 0) {
currentTip.add(I18n.format("ggfab.waila.advassline.slice.idle", i + 1));
} else if (duration > 40) {
- currentTip.add(I18n.format("ggfab.waila.advassline.slice", i + 1, (duration - progress) / 20, duration / 20));
+ currentTip.add(
+ I18n.format(
+ "ggfab.waila.advassline.slice",
+ i + 1,
+ (duration - progress) / 20,
+ duration / 20));
} else {
- currentTip.add(I18n.format("ggfab.waila.advassline.slice.small", i + 1, duration - progress, duration));
+ currentTip.add(
+ I18n.format("ggfab.waila.advassline.slice.small", i + 1, duration - progress, duration));
}
}
}
}
@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 (currentRecipe == null || !getBaseMetaTileEntity().isActive()) return;
NBTTagList l = new NBTTagList();
@@ -793,6 +760,7 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas
}
private class Slice {
+
private final int id;
private int progress = -1;
@@ -805,31 +773,26 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas
}
public void tick() {
- if (progress < 0)
- return;
+ if (progress < 0) return;
if (progress == 0 || --progress == 0) {
// id==0 will be end of chain if 1 input, so we need a +1 here
if (id + 1 >= currentRecipe.mInputs.length) {
addOutput(currentRecipe.mOutput);
reset();
} else {
- if (slices[id + 1].start())
- reset();
- else
- stuck = true;
+ if (slices[id + 1].start()) reset();
+ else stuck = true;
}
}
}
public boolean start() {
- if (progress >= 0)
- return false;
+ if (progress >= 0) return false;
startRecipeProcessing();
GT_MetaTileEntity_Hatch_InputBus bus = mInputBusses.get(id);
ItemStack stack = bus.getStackInSlot(0);
int size = isStackValidIngredient(stack, currentRecipe.mInputs[id], currentRecipe.mOreDictAlt[id]);
- if (size < 0)
- return false;
+ if (size < 0) return false;
progress = mMaxProgresstime / currentRecipe.mInputs.length;
stack.stackSize -= size;
bus.updateSlots();
@@ -850,14 +813,12 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas
@Override
public String toString() {
- return "Slice{" +
- "id=" + id +
- ", progress=" + progress +
- '}';
+ return "Slice{" + "id=" + id + ", progress=" + progress + '}';
}
}
private enum DataHatchElement implements IHatchElement<MTE_AdvAssLine> {
+
DataAccess;
@Override
diff --git a/src/main/java/net/glease/ggfab/mte/MTE_LinkedInputBus.java b/src/main/java/net/glease/ggfab/mte/MTE_LinkedInputBus.java
index 6e59475ddd..5d7bd737fc 100644
--- a/src/main/java/net/glease/ggfab/mte/MTE_LinkedInputBus.java
+++ b/src/main/java/net/glease/ggfab/mte/MTE_LinkedInputBus.java
@@ -1,5 +1,20 @@
package net.glease.ggfab.mte;
+import java.util.*;
+
+import net.glease.ggfab.GGConstants;
+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.NBTBase;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.ChatComponentTranslation;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.WorldSavedData;
+import net.minecraftforge.common.util.Constants;
+import net.minecraftforge.common.util.ForgeDirection;
+
import com.gtnewhorizons.modularui.api.drawable.Text;
import com.gtnewhorizons.modularui.api.forge.ItemStackHandler;
import com.gtnewhorizons.modularui.api.math.Alignment;
@@ -9,6 +24,7 @@ import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
import com.gtnewhorizons.modularui.common.internal.wrapper.BaseSlot;
import com.gtnewhorizons.modularui.common.widget.*;
import com.gtnewhorizons.modularui.common.widget.textfield.TextFieldWidget;
+
import gregtech.api.enums.ItemList;
import gregtech.api.gui.modularui.GT_UITextures;
import gregtech.api.interfaces.ITexture;
@@ -17,22 +33,9 @@ import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
-import net.glease.ggfab.GGConstants;
-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.NBTBase;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.util.ChatComponentTranslation;
-import net.minecraft.util.StatCollector;
-import net.minecraft.world.WorldSavedData;
-import net.minecraftforge.common.util.Constants;
-import net.minecraftforge.common.util.ForgeDirection;
-
-import java.util.*;
public class MTE_LinkedInputBus extends GT_MetaTileEntity_Hatch_InputBus {
+
public static final int SIZE_INVENTORY = 18;
private SharedInventory mRealInventory;
private final ItemStackHandlerProxy handler = new ItemStackHandlerProxy();
@@ -42,12 +45,15 @@ public class MTE_LinkedInputBus extends GT_MetaTileEntity_Hatch_InputBus {
private WorldSave save;
public MTE_LinkedInputBus(int id, String name, String nameRegional, int tier) {
- super(id, name, nameRegional, tier, 1, new String[]{
- SIZE_INVENTORY + " slot input bus linked together wirelessly",
- "Link does not cross world boundary",
- "Left/right click with data stick to copy/paste configuration",
- GGConstants.GGMARK_TOOLTIP,
- });
+ super(
+ id,
+ name,
+ nameRegional,
+ tier,
+ 1,
+ new String[] { SIZE_INVENTORY + " slot input bus linked together wirelessly",
+ "Link does not cross world boundary",
+ "Left/right click with data stick to copy/paste configuration", GGConstants.GGMARK_TOOLTIP, });
}
public MTE_LinkedInputBus(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
@@ -66,47 +72,37 @@ public class MTE_LinkedInputBus extends GT_MetaTileEntity_Hatch_InputBus {
@Override
public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) {
- builder.widget(new TextFieldWidget()
- .setSynced(true, true)
- .setGetter(() -> mChannel == null ? "" : mChannel)
- .setSetter(this::setChannel)
- .setTextColor(Color.WHITE.dark(1))
- .setTextAlignment(Alignment.CenterLeft)
- .setBackground(GT_UITextures.BACKGROUND_TEXT_FIELD)
+ builder.widget(
+ new TextFieldWidget().setSynced(true, true).setGetter(() -> mChannel == null ? "" : mChannel)
+ .setSetter(this::setChannel).setTextColor(Color.WHITE.dark(1))
+ .setTextAlignment(Alignment.CenterLeft).setBackground(GT_UITextures.BACKGROUND_TEXT_FIELD)
.setGTTooltip(() -> mTooltipCache.getData("ggfab.tooltip.linked_input_bus.change_freq_warn"))
- .setSize(60, 18)
- .setPos(48, 3))
- .widget(new CycleButtonWidget()
- .setToggle(this::isPrivate, this::setPrivate)
- .setTextureGetter(i -> i == 1 ? GT_UITextures.OVERLAY_BUTTON_CHECKMARK : GT_UITextures.OVERLAY_BUTTON_CROSS)
- .setVariableBackground(GT_UITextures.BUTTON_STANDARD_TOGGLE)
- .setSynced(true, true)
- .setGTTooltip(() -> mTooltipCache.getData("ggfab.tooltip.linked_input_bus.private"))
- .setSize(18, 18)
- .setPos(150, 3))
- .widget(SlotGroup.ofItemHandler(handler, 9)
- .startFromSlot(0)
- .endAtSlot(SIZE_INVENTORY - 1)
- .background(getGUITextureSet().getItemSlot())
- .slotCreator(i -> new BaseSlot(handler, i, false) {
- @Override
- public ItemStack getStack() {
- return isEnabled() ? super.getStack() : null;
- }
-
- @Override
- public boolean isEnabled() {
- return mChannel != null;
- }
- })
- .build()
- .setPos(7, 24))
- .widget(new TextWidget(new Text("Private"))
- .setPos(110, 3)
- .setSize(43, 20))
- .widget(new TextWidget(new Text("Channel"))
- .setPos(5, 3)
- .setSize(43, 20));
+ .setSize(60, 18).setPos(48, 3))
+ .widget(
+ new CycleButtonWidget().setToggle(this::isPrivate, this::setPrivate)
+ .setTextureGetter(
+ i -> i == 1 ? GT_UITextures.OVERLAY_BUTTON_CHECKMARK
+ : GT_UITextures.OVERLAY_BUTTON_CROSS)
+ .setVariableBackground(GT_UITextures.BUTTON_STANDARD_TOGGLE).setSynced(true, true)
+ .setGTTooltip(() -> mTooltipCache.getData("ggfab.tooltip.linked_input_bus.private"))
+ .setSize(18, 18).setPos(150, 3))
+ .widget(
+ SlotGroup.ofItemHandler(handler, 9).startFromSlot(0).endAtSlot(SIZE_INVENTORY - 1)
+ .background(getGUITextureSet().getItemSlot())
+ .slotCreator(i -> new BaseSlot(handler, i, false) {
+
+ @Override
+ public ItemStack getStack() {
+ return isEnabled() ? super.getStack() : null;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return mChannel != null;
+ }
+ }).build().setPos(7, 24))
+ .widget(new TextWidget(new Text("Private")).setPos(110, 3).setSize(43, 20))
+ .widget(new TextWidget(new Text("Channel")).setPos(5, 3).setSize(43, 20));
}
@Override
@@ -116,11 +112,9 @@ public class MTE_LinkedInputBus extends GT_MetaTileEntity_Hatch_InputBus {
@Override
public ItemStack getStackInSlot(int aIndex) {
- if (aIndex == getCircuitSlot())
- return super.getStackInSlot(aIndex);
+ if (aIndex == getCircuitSlot()) return super.getStackInSlot(aIndex);
if (mState != State.Blocked && mChannel != null && mRealInventory != null) {
- if (aIndex > 0 && aIndex <= SIZE_INVENTORY)
- return mRealInventory.stacks[aIndex - 1];
+ if (aIndex > 0 && aIndex <= SIZE_INVENTORY) return mRealInventory.stacks[aIndex - 1];
}
return null;
}
@@ -150,20 +144,20 @@ public class MTE_LinkedInputBus extends GT_MetaTileEntity_Hatch_InputBus {
@Override
public boolean canInsertItem(int aIndex, ItemStack aStack, int ordinalSide) {
- return isValidSlot(aIndex)
- && aStack != null
+ return isValidSlot(aIndex) && aStack != null
&& mChannel != null
&& mRealInventory != null
&& aIndex > getCircuitSlot()
&& aIndex < SIZE_INVENTORY + 1
- && (mRealInventory.stacks[aIndex - 1] == null || GT_Utility.areStacksEqual(aStack, mRealInventory.stacks[aIndex - 1]))
+ && (mRealInventory.stacks[aIndex - 1] == null
+ || GT_Utility.areStacksEqual(aStack, mRealInventory.stacks[aIndex - 1]))
&& allowPutStack(getBaseMetaTileEntity(), aIndex, ForgeDirection.getOrientation(ordinalSide), aStack);
}
@Override
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, ItemStack aStack) {
- return side == getBaseMetaTileEntity().getFrontFacing()
- && aIndex != getCircuitSlot()
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side,
+ ItemStack aStack) {
+ return side == getBaseMetaTileEntity().getFrontFacing() && aIndex != getCircuitSlot()
&& (mRecipeMap == null || disableFilter || mRecipeMap.containsInput(aStack))
&& (mRealInventory.disableLimited || limitedAllowPutStack(aIndex, aStack));
}
@@ -183,8 +177,7 @@ public class MTE_LinkedInputBus extends GT_MetaTileEntity_Hatch_InputBus {
@Override
public int getSizeInventory() {
- if (mState != State.Blocked && mChannel != null && mRealInventory != null)
- return SIZE_INVENTORY + 1;
+ if (mState != State.Blocked && mChannel != null && mRealInventory != null) return SIZE_INVENTORY + 1;
return 1;
}
@@ -256,7 +249,8 @@ public class MTE_LinkedInputBus extends GT_MetaTileEntity_Hatch_InputBus {
private void dropItems(ItemStack[] aStacks) {
for (ItemStack stack : aStacks) {
if (!GT_Utility.isStackValid(stack)) continue;
- EntityItem ei = new EntityItem(getBaseMetaTileEntity().getWorld(),
+ EntityItem ei = new EntityItem(
+ getBaseMetaTileEntity().getWorld(),
getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 1) + 0.5,
getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 1) + 0.5,
getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 1) + 0.5,
@@ -275,16 +269,14 @@ public class MTE_LinkedInputBus extends GT_MetaTileEntity_Hatch_InputBus {
public void onBlockDestroyed() {
super.onBlockDestroyed();
if (mRealInventory != null) {
- if (--mRealInventory.ref <= 0)
- getWorldSave().remove(mChannel);
+ if (--mRealInventory.ref <= 0) getWorldSave().remove(mChannel);
}
}
@Override
public void saveNBTData(NBTTagCompound aNBT) {
super.saveNBTData(aNBT);
- if (mChannel != null)
- aNBT.setString("channel", mChannel);
+ if (mChannel != null) aNBT.setString("channel", mChannel);
aNBT.setBoolean("private", mPrivate);
}
@@ -292,8 +284,7 @@ public class MTE_LinkedInputBus extends GT_MetaTileEntity_Hatch_InputBus {
public void loadNBTData(NBTTagCompound aNBT) {
super.loadNBTData(aNBT);
String channel = aNBT.getString("channel");
- if ("".equals(channel))
- channel = null;
+ if ("".equals(channel)) channel = null;
this.mChannel = channel;
mPrivate = aNBT.getBoolean("private");
}
@@ -313,13 +304,12 @@ public class MTE_LinkedInputBus extends GT_MetaTileEntity_Hatch_InputBus {
@Override
public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- if (!getBaseMetaTileEntity()
- .getCoverBehaviorAtSideNew(side)
- .isGUIClickable(
- side,
- getBaseMetaTileEntity().getCoverIDAtSide(side),
- getBaseMetaTileEntity().getComplexCoverDataAtSide(side),
- getBaseMetaTileEntity())) return;
+ if (!getBaseMetaTileEntity().getCoverBehaviorAtSideNew(side).isGUIClickable(
+ side,
+ getBaseMetaTileEntity().getCoverIDAtSide(side),
+ getBaseMetaTileEntity().getComplexCoverDataAtSide(side),
+ getBaseMetaTileEntity()))
+ return;
if (aPlayer.isSneaking()) {
if (this.mRealInventory == null) {
aPlayer.addChatMessage(new ChatComponentTranslation("ggfab.info.linked_input_bus.no_channel"));
@@ -338,21 +328,24 @@ public class MTE_LinkedInputBus extends GT_MetaTileEntity_Hatch_InputBus {
GT_Utility.sendChatToPlayer(
aPlayer,
StatCollector.translateToLocal("GT5U.hatch.disableSort." + mRealInventory.disableSort) + " "
- + StatCollector.translateToLocal("GT5U.hatch.disableLimited." + mRealInventory.disableLimited));
+ + StatCollector
+ .translateToLocal("GT5U.hatch.disableLimited." + mRealInventory.disableLimited));
} else {
this.disableFilter = !this.disableFilter;
GT_Utility.sendChatToPlayer(
- aPlayer, StatCollector.translateToLocal("GT5U.hatch.disableFilter." + this.disableFilter));
+ aPlayer,
+ StatCollector.translateToLocal("GT5U.hatch.disableFilter." + this.disableFilter));
}
}
@Override
- public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, ForgeDirection side, float aX, float aY, float aZ) {
- if (!(aPlayer instanceof EntityPlayerMP)) return super.onRightclick(aBaseMetaTileEntity, aPlayer,
- side, aX, aY, aZ);
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, ForgeDirection side,
+ float aX, float aY, float aZ) {
+ if (!(aPlayer instanceof EntityPlayerMP))
+ return super.onRightclick(aBaseMetaTileEntity, aPlayer, side, aX, aY, aZ);
ItemStack stick = aPlayer.inventory.getCurrentItem();
- if (!ItemList.Tool_DataStick.isStackEqual(stick, true, true)) return super.onRightclick(aBaseMetaTileEntity, aPlayer,
- side, aX, aY, aZ);
+ if (!ItemList.Tool_DataStick.isStackEqual(stick, true, true))
+ return super.onRightclick(aBaseMetaTileEntity, aPlayer, side, aX, aY, aZ);
if (!stick.hasTagCompound() || !"linkedinputbus".equals(stick.stackTagCompound.getString("ggfab.type"))) {
aPlayer.addChatMessage(new ChatComponentTranslation("ggfab.info.linked_input_bus.no_data"));
return true;
@@ -367,9 +360,9 @@ public class MTE_LinkedInputBus extends GT_MetaTileEntity_Hatch_InputBus {
aPlayer.addChatMessage(new ChatComponentTranslation("ggfab.info.linked_input_bus.no_data"));
return true;
}
- UUID owner = stick.stackTagCompound.hasKey("owner1") ?
- new UUID(stick.stackTagCompound.getLong("owner1"), stick.stackTagCompound.getLong("owner2")) :
- null;
+ UUID owner = stick.stackTagCompound.hasKey("owner1")
+ ? new UUID(stick.stackTagCompound.getLong("owner1"), stick.stackTagCompound.getLong("owner2"))
+ : null;
if (owner != null && !owner.equals(getBaseMetaTileEntity().getOwnerUuid())) {
aPlayer.addChatMessage(new ChatComponentTranslation("ggfab.info.linked_input_bus.not_owned"));
return true;
@@ -469,7 +462,8 @@ public class MTE_LinkedInputBus extends GT_MetaTileEntity_Hatch_InputBus {
private WorldSave getWorldSave() {
if (save == null) {
- WorldSave save = (WorldSave) getBaseMetaTileEntity().getWorld().loadItemData(WorldSave.class, "LinkedInputBusses");
+ WorldSave save = (WorldSave) getBaseMetaTileEntity().getWorld()
+ .loadItemData(WorldSave.class, "LinkedInputBusses");
if (save == null) {
save = new WorldSave("LinkedInputBusses");
getBaseMetaTileEntity().getWorld().setItemData(save.mapName, save);
@@ -486,6 +480,7 @@ public class MTE_LinkedInputBus extends GT_MetaTileEntity_Hatch_InputBus {
}
private static class SharedInventory {
+
private final ItemStack[] stacks;
/**
* Inventory wrapper for ModularUI
@@ -531,6 +526,7 @@ public class MTE_LinkedInputBus extends GT_MetaTileEntity_Hatch_InputBus {
}
public static class WorldSave extends WorldSavedData {
+
private final Map<String, SharedInventory> data = new HashMap<>();
public WorldSave(String p_i2141_1_) {
@@ -550,8 +546,7 @@ public class MTE_LinkedInputBus extends GT_MetaTileEntity_Hatch_InputBus {
@Override
public void writeToNBT(NBTTagCompound tag) {
for (Map.Entry<String, SharedInventory> e : data.entrySet()) {
- if (e.getValue().ref > 0)
- tag.setTag(e.getKey(), e.getValue().save());
+ if (e.getValue().ref > 0) tag.setTag(e.getKey(), e.getValue().save());
}
}
@@ -566,6 +561,7 @@ public class MTE_LinkedInputBus extends GT_MetaTileEntity_Hatch_InputBus {
}
private static class ItemStackHandlerProxy extends ItemStackHandler {
+
private static final ItemStack[] EMPTY = new ItemStack[SIZE_INVENTORY];
private boolean fake;
diff --git a/src/main/java/net/glease/ggfab/nei/IMCForNEI.java b/src/main/java/net/glease/ggfab/nei/IMCForNEI.java
index ed96005bd4..71a2f82336 100644
--- a/src/main/java/net/glease/ggfab/nei/IMCForNEI.java
+++ b/src/main/java/net/glease/ggfab/nei/IMCForNEI.java
@@ -1,8 +1,9 @@
package net.glease.ggfab.nei;
-import cpw.mods.fml.common.event.FMLInterModComms;
import net.minecraft.nbt.NBTTagCompound;
+import cpw.mods.fml.common.event.FMLInterModComms;
+
public class IMCForNEI {
public static void IMCSender() {
diff --git a/src/main/java/net/glease/ggfab/util/GGUtils.java b/src/main/java/net/glease/ggfab/util/GGUtils.java
index 1f47c82885..66ff5d9361 100644
--- a/src/main/java/net/glease/ggfab/util/GGUtils.java
+++ b/src/main/java/net/glease/ggfab/util/GGUtils.java
@@ -1,21 +1,32 @@
package net.glease.ggfab.util;
-import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import java.util.StringJoiner;
+
import net.minecraft.util.ChunkCoordinates;
import net.minecraftforge.common.util.ForgeDirection;
-import java.util.StringJoiner;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
public class GGUtils {
+
public static boolean isValidTile(IGregTechTileEntity tile) {
- return tile != null && !tile.isDead() && tile.getMetaTileEntity() != null && tile.getMetaTileEntity().getBaseMetaTileEntity() == tile;
+ return tile != null && !tile.isDead()
+ && tile.getMetaTileEntity() != null
+ && tile.getMetaTileEntity().getBaseMetaTileEntity() == tile;
}
+
public static boolean isValidTile(IMetaTileEntity mte) {
- return mte != null && mte.getBaseMetaTileEntity() != null && mte.getBaseMetaTileEntity().getMetaTileEntity() == mte && !mte.getBaseMetaTileEntity().isDead();
+ return mte != null && mte.getBaseMetaTileEntity() != null
+ && mte.getBaseMetaTileEntity().getMetaTileEntity() == mte
+ && !mte.getBaseMetaTileEntity().isDead();
}
+
public static ChunkCoordinates translate(ChunkCoordinates origin, ForgeDirection direction) {
- return new ChunkCoordinates(origin.posX + direction.offsetX, origin.posY + direction.offsetY, origin.posZ + direction.offsetZ);
+ return new ChunkCoordinates(
+ origin.posX + direction.offsetX,
+ origin.posY + direction.offsetY,
+ origin.posZ + direction.offsetZ);
}
public static String formatTileInfo(String prefix, IMetaTileEntity mte, String delimiter, String suffix) {
diff --git a/src/main/java/net/glease/ggfab/util/OverclockHelper.java b/src/main/java/net/glease/ggfab/util/OverclockHelper.java
index b188089ed9..bd75a02269 100644
--- a/src/main/java/net/glease/ggfab/util/OverclockHelper.java
+++ b/src/main/java/net/glease/ggfab/util/OverclockHelper.java
@@ -3,6 +3,7 @@ package net.glease.ggfab.util;
import gregtech.api.util.GT_Utility;
public class OverclockHelper {
+
public static OverclockOutput normalOverclock(long recipeEUt, int duration, long inputVoltage, boolean perfectOC) {
if (recipeEUt > inputVoltage) return null;
int recipeTier = Math.max(1, GT_Utility.getTier(recipeEUt)); // ULV no overclock
@@ -16,7 +17,8 @@ public class OverclockHelper {
return new OverclockOutput(recipeEUt, duration);
}
- public static OverclockOutput laserOverclock(long recipeEUt, int duration, long inputEUt, float penaltyIncreaseFactor) {
+ public static OverclockOutput laserOverclock(long recipeEUt, int duration, long inputEUt,
+ float penaltyIncreaseFactor) {
if (recipeEUt > inputEUt) return null;
float currentPenalty = 4 + penaltyIncreaseFactor;
// 2/(n+k) overclock until energy hatch is crying
@@ -30,6 +32,7 @@ public class OverclockHelper {
}
public static final class OverclockOutput {
+
private final long mEUt;
private final int mDuration;
diff --git a/src/test/java/net/glease/ggfab/util/OverclockHelperTest.java b/src/test/java/net/glease/ggfab/util/OverclockHelperTest.java
index f9b2a091c3..9ae2761357 100644
--- a/src/test/java/net/glease/ggfab/util/OverclockHelperTest.java
+++ b/src/test/java/net/glease/ggfab/util/OverclockHelperTest.java
@@ -1,9 +1,9 @@
package net.glease.ggfab.util;
-import org.junit.jupiter.api.Test;
-
import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
+
class OverclockHelperTest {
@Test
@@ -15,9 +15,13 @@ class OverclockHelperTest {
// imperfect overclock
assertEquals(new OverclockHelper.OverclockOutput(120, 32), OverclockHelper.normalOverclock(30, 64, 128, false));
// lots of overclock
- assertEquals(new OverclockHelper.OverclockOutput(30720, 2), OverclockHelper.normalOverclock(30, 64, 32768, false));
+ assertEquals(
+ new OverclockHelper.OverclockOutput(30720, 2),
+ OverclockHelper.normalOverclock(30, 64, 32768, false));
// do not overclock beyond useful
- assertEquals(new OverclockHelper.OverclockOutput(122880, 1), OverclockHelper.normalOverclock(30, 64, 524288, false));
+ assertEquals(
+ new OverclockHelper.OverclockOutput(122880, 1),
+ OverclockHelper.normalOverclock(30, 64, 524288, false));
}
@Test
@@ -29,10 +33,14 @@ class OverclockHelperTest {
// 0.3 amp overclock. 0.25 amp would be not in current tier so no point in testing that
assertEquals(new OverclockHelper.OverclockOutput(10, 64), OverclockHelper.laserOverclock(10, 64, 32, 0.5f));
// laser overclock
- assertEquals(new OverclockHelper.OverclockOutput(135, 32), OverclockHelper.laserOverclock(30, 64, 32 * 16, 0.5f));
+ assertEquals(
+ new OverclockHelper.OverclockOutput(135, 32),
+ OverclockHelper.laserOverclock(30, 64, 32 * 16, 0.5f));
// lots of overclock
- assertEquals(new OverclockHelper.OverclockOutput(22272, 4), OverclockHelper.laserOverclock(30, 64, 32 * 1024, 0.5f));
+ assertEquals(
+ new OverclockHelper.OverclockOutput(22272, 4),
+ OverclockHelper.laserOverclock(30, 64, 32 * 1024, 0.5f));
// do not overclock beyond useful
assertEquals(new OverclockHelper.OverclockOutput(135, 1), OverclockHelper.laserOverclock(30, 2, 32 * 16, 0.5f));
}
-} \ No newline at end of file
+}