aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGlease <4586901+Glease@users.noreply.github.com>2022-11-13 22:26:03 +0800
committerGlease <4586901+Glease@users.noreply.github.com>2022-11-13 22:26:03 +0800
commit7d0b6e0c15b651c39e4b560d092853eec4262115 (patch)
tree36c83ba4e9bc35eeaa614fbef6a4bad3d704deab /src
parentd76948f4c064c8b6c3665e6c062b7d181f1f148c (diff)
downloadGT5-Unofficial-7d0b6e0c15b651c39e4b560d092853eec4262115.tar.gz
GT5-Unofficial-7d0b6e0c15b651c39e4b560d092853eec4262115.tar.bz2
GT5-Unofficial-7d0b6e0c15b651c39e4b560d092853eec4262115.zip
adv assline
Diffstat (limited to 'src')
-rw-r--r--src/main/java/net/glease/ggfab/BlockIcons.java6
-rw-r--r--src/main/java/net/glease/ggfab/ComponentRecipeLoader.java37
-rw-r--r--src/main/java/net/glease/ggfab/GGItemList.java1
-rw-r--r--src/main/java/net/glease/ggfab/GigaGramFab.java15
-rw-r--r--src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java570
-rw-r--r--src/main/resources/META-INF/ggfab_at.cfg1
-rw-r--r--src/main/resources/assets/ggfab/lang/en_US.lang4
-rw-r--r--src/main/resources/assets/ggfab/textures/blocks/iconsets/OVERLAY_FRONT_ADV_ASSLINE.pngbin0 -> 382 bytes
-rw-r--r--src/main/resources/assets/ggfab/textures/blocks/iconsets/OVERLAY_FRONT_ADV_ASSLINE_ACTIVE.pngbin0 -> 389 bytes
-rw-r--r--src/main/resources/assets/ggfab/textures/blocks/iconsets/OVERLAY_FRONT_ADV_ASSLINE_ACTIVE_GLOW.pngbin0 -> 379 bytes
-rw-r--r--src/main/resources/assets/ggfab/textures/blocks/iconsets/OVERLAY_FRONT_ADV_ASSLINE_GLOW.pngbin0 -> 378 bytes
-rw-r--r--src/main/resources/assets/ggfab/textures/blocks/iconsets/OVERLAY_FRONT_ADV_ASSLINE_STUCK.pngbin0 -> 330 bytes
-rw-r--r--src/main/resources/assets/ggfab/textures/blocks/iconsets/OVERLAY_FRONT_ADV_ASSLINE_STUCK_GLOW.pngbin0 -> 219 bytes
13 files changed, 633 insertions, 1 deletions
diff --git a/src/main/java/net/glease/ggfab/BlockIcons.java b/src/main/java/net/glease/ggfab/BlockIcons.java
index 7879ba9bdb..7e1cfe43ef 100644
--- a/src/main/java/net/glease/ggfab/BlockIcons.java
+++ b/src/main/java/net/glease/ggfab/BlockIcons.java
@@ -7,6 +7,12 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
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,
;
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
new file mode 100644
index 0000000000..76cc11b524
--- /dev/null
+++ b/src/main/java/net/glease/ggfab/ComponentRecipeLoader.java
@@ -0,0 +1,37 @@
+package net.glease.ggfab;
+
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+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
+ ? FluidRegistry.getFluid("molten.indalloy140")
+ : FluidRegistry.getFluid("molten.solderingalloy");
+ 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)
+ },
+ GGItemList.AdvAssLine.get(1L),
+ 1200,
+ 6000
+ );
+ }
+}
diff --git a/src/main/java/net/glease/ggfab/GGItemList.java b/src/main/java/net/glease/ggfab/GGItemList.java
index d126419ec1..f3f3655f2f 100644
--- a/src/main/java/net/glease/ggfab/GGItemList.java
+++ b/src/main/java/net/glease/ggfab/GGItemList.java
@@ -11,6 +11,7 @@ import net.minecraft.item.ItemStack;
import static gregtech.api.enums.GT_Values.W;
public enum GGItemList implements IItemContainer{
+ AdvAssLine,
;
private ItemStack mStack;
diff --git a/src/main/java/net/glease/ggfab/GigaGramFab.java b/src/main/java/net/glease/ggfab/GigaGramFab.java
index 580a967504..14a62ea421 100644
--- a/src/main/java/net/glease/ggfab/GigaGramFab.java
+++ b/src/main/java/net/glease/ggfab/GigaGramFab.java
@@ -2,12 +2,25 @@ package net.glease.ggfab;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.*;
+import gregtech.api.GregTech_API;
+import gregtech.loaders.materialprocessing.ProcessingModSupport;
+import net.glease.ggfab.mte.MTE_AdvAssLine;
-@Mod(modid = GGConstants.MODID, version = GGConstants.VERSION, name = GGConstants.MODNAME, acceptedMinecraftVersions = "[1.7.10]", dependencies = "required-after:IC2;required-after:gregtech")
+@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
+ BlockIcons.OVERLAY_FRONT_ADV_ASSLINE.name();
+ }
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
+ ProcessingModSupport.aTGregSupport =true;
+ GregTech_API.sAfterGTPreload.add(() -> {
+ GGItemList.AdvAssLine.set(new MTE_AdvAssLine(13532, "ggfab.machine.adv_assline", "Advanced Assembly Line").getStackForm(1));
+ });
+ GregTech_API.sBeforeGTPostload.add(new ComponentRecipeLoader());
}
@Mod.EventHandler
diff --git a/src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java b/src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java
new file mode 100644
index 0000000000..25816e7b3e
--- /dev/null
+++ b/src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java
@@ -0,0 +1,570 @@
+package net.glease.ggfab.mte;
+
+import gregtech.api.enums.GT_Values;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
+import gregtech.api.render.TextureFactory;
+import gregtech.api.util.*;
+import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_AssemblyLine;
+import mcp.mobius.waila.api.IWailaConfigHandler;
+import mcp.mobius.waila.api.IWailaDataAccessor;
+import net.glease.ggfab.GGConstants;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagInt;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.Constants;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.IntStream;
+
+import static gregtech.GT_Mod.GT_FML_LOGGER;
+import static gregtech.api.enums.GT_Values.V;
+import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages;
+import static net.glease.ggfab.BlockIcons.*;
+
+/*
+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_AssemblyLine {
+ public static final String TAG_KEY_CURRENT_STICK = "mCurrentStick";
+ public static final String TAG_KEY_PROGRESS_TIMES = "mProgressTimeArray";
+ public static final String TAG_KEY_PROGRESS_ITEMS = "mProgressItemArray";
+ private ItemStack currentStick;
+ private GT_Recipe.GT_Recipe_AssemblyLine currentRecipe;
+ private final Slice[] slices = IntStream.range(0, 16).mapToObj(Slice::new).toArray(Slice[]::new);
+ private boolean processing;
+ private long inputVoltage;
+ private long baseEUt;
+ private boolean stuck;
+
+ public MTE_AdvAssLine(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public MTE_AdvAssLine(String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new MTE_AdvAssLine(mName);
+ }
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ if (aSide == aFacing) {
+ 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()
+ };
+ }
+ 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")
+ .addInfo("Built exactly the same as standard Assembling Line")
+ .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()
+ .beginVariableStructureBlock(5, 16, 4, 4, 3, 3, false)
+ .addStructureInfo("From Bottom to Top, Left to Right")
+ .addStructureInfo(
+ "Layer 1 - Solid Steel Machine Casing, Input Bus (last can be Output Bus), Solid Steel Machine Casing")
+ .addStructureInfo(
+ "Layer 2 - Borosilicate Glass(any)/Warded Glass/Reinforced Glass, Assembling Line Casing, Reinforced Glass")
+ .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)
+ .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)
+ .toolTipFinisher(GGConstants.GGMARK);
+ return tt;
+ }
+
+ private void setCurrentRecipe(ItemStack stick, GT_Recipe.GT_Recipe_AssemblyLine recipe) {
+ currentRecipe = recipe;
+ currentStick = stick;
+ }
+
+ private void clearCurrentRecipe() {
+ currentRecipe = null;
+ currentStick = null;
+ for (Slice slice : slices) {
+ slice.reset();
+ }
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ // we need to check for active here.
+ // if machine was turned off via soft mallet it will not call checkRecipe() on recipe end
+ // in that case we don't have a current recipe, so this should be ignored
+ 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());
+ }
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ ItemStack loadedStack = null;
+ GT_Recipe.GT_Recipe_AssemblyLine recipe = null;
+ if (aNBT.hasKey(TAG_KEY_PROGRESS_TIMES, Constants.NBT.TAG_INT_ARRAY)) {
+ int[] arr = aNBT.getIntArray(TAG_KEY_PROGRESS_TIMES);
+ for (int i = 0; i < slices.length; i++) {
+ if (i < arr.length) {
+ slices[i].progress = arr[i];
+ if (arr[i] == 0)
+ // this will be synced to client by first MTE packet to client
+ stuck = true;
+ } 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, true);
+ switch (lookupResult.getType()) {
+ case VALID_STACK_AND_VALID_HASH:
+ recipe = lookupResult.getRecipe();
+ break;
+ case VALID_STACK_AND_VALID_RECIPE:
+ // recipe is there, but it has been changed. to prevent issues, abort the current recipe
+ // TODO finish the last recipe instead of aborting
+ default:
+ // recipe is gone. to prevent issues, abort the current recipe
+ criticalStopMachine();
+ loadedStack = null;
+ break;
+ }
+ }
+ setCurrentRecipe(loadedStack, recipe);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ if (super.checkMachine(aBaseMetaTileEntity, aStack)) {
+ if (mEnergyHatches.isEmpty() && mExoticEnergyHatches.isEmpty())
+ return false;
+ inputVoltage = Integer.MAX_VALUE;
+ for (GT_MetaTileEntity_Hatch tHatch : mEnergyHatches) {
+ inputVoltage = Math.min(inputVoltage, tHatch.maxEUInput());
+ }
+ for (GT_MetaTileEntity_Hatch tHatch : mExoticEnergyHatches) {
+ inputVoltage = Math.min(inputVoltage, tHatch.maxEUInput());
+ }
+ return true;
+ } else {
+ inputVoltage = V[0];
+ return false;
+ }
+ }
+
+ @Override
+ protected void startRecipeProcessing() {
+ if (!processing)
+ super.startRecipeProcessing();
+ }
+
+ @Override
+ protected void endRecipeProcessing() {
+ if (!processing)
+ return;
+ super.endRecipeProcessing();
+ processing = false;
+ }
+
+ @Override
+ public void onValueUpdate(byte aValue) {
+ stuck = (aValue & 1) == 1;
+ }
+
+ @Override
+ public byte getUpdateData() {
+ return (byte) (stuck ? 1 : 0);
+ }
+
+ @Override
+ public boolean onRunningTick(ItemStack aStack) {
+ if (currentRecipe == null) {
+ criticalStopMachine();
+ return false;
+ }
+ if (!super.onRunningTick(aStack))
+ return false;
+
+ if (mInputBusses.size() <= currentRecipe.mInputs.length) {
+ criticalStopMachine();
+ return false;
+ }
+ boolean oStuck = stuck;
+ stuck = false;
+
+ for (int i = slices.length - 1; i >= 0; i--) {
+ slices[i].tick();
+ }
+
+ if (oStuck != stuck)
+ // send the status as it has changed
+ getBaseMetaTileEntity().issueClientUpdate();
+
+ boolean foundWorking = false;
+ int tEUt = 0;
+ for (Slice slice : slices) {
+ if (slice.progress >= 0) {
+ if (!foundWorking) {
+ foundWorking = true;
+ mProgresstime = (slice.id + 1) * (mMaxProgresstime / currentRecipe.mInputs.length) - slice.progress;
+ }
+ }
+ if (slice.progress > 0)
+ tEUt += baseEUt;
+ }
+ mEUt = tEUt;
+
+ if (slices[0].canStart() && getBaseMetaTileEntity().isAllowedToWork()) {
+ if (hasAllFluids(currentRecipe)) {
+ drainAllFluids(currentRecipe);
+ slices[0].start();
+ mProgresstime = 0;
+ }
+ }
+
+ endRecipeProcessing();
+ return true;
+ }
+
+ private GT_Recipe.GT_Recipe_AssemblyLine findRecipe(ItemStack tDataStick) {
+ GT_AssemblyLineUtils.LookupResult tLookupResult =
+ GT_AssemblyLineUtils.findAssemblyLineRecipeFromDataStick(tDataStick, false);
+
+ if (tLookupResult.getType() == GT_AssemblyLineUtils.LookupResultType.INVALID_STICK) return null;
+
+ GT_Recipe.GT_Recipe_AssemblyLine tRecipe = tLookupResult.getRecipe();
+ // Check if the recipe on the data stick is the current recipe for it's given output, if not we update it
+ // and continue to next.
+ if (tLookupResult.getType() != GT_AssemblyLineUtils.LookupResultType.VALID_STACK_AND_VALID_HASH) {
+ tRecipe = GT_AssemblyLineUtils.processDataStick(tDataStick);
+ if (tRecipe == null) {
+ return null;
+ }
+ }
+
+ // So here we check against the recipe found on the data stick.
+ // If we run into missing buses/hatches or bad inputs, we go to the next data stick.
+ // This check only happens if we have a valid up-to-date data stick.
+
+ // Check Inputs allign
+ int aItemCount = tRecipe.mInputs.length;
+ for (int i = 0; i < aItemCount; i++) {
+ GT_MetaTileEntity_Hatch_InputBus tInputBus = mInputBusses.get(i);
+ if (tInputBus == null) {
+ return null;
+ }
+ ItemStack tSlotStack = tInputBus.getStackInSlot(0);
+ int tRequiredStackSize = isStackValidIngredient(tSlotStack, tRecipe.mInputs[i], tRecipe.mOreDictAlt[i]);
+ if (tRequiredStackSize < 0) return null;
+
+ if (GT_Values.D1) {
+ GT_FML_LOGGER.info("Item: " + i + " accepted");
+ }
+ }
+
+ // Check Fluid Inputs allign
+ if (!hasAllFluids(tRecipe))
+ return null;
+
+ if (GT_Values.D1) {
+ GT_FML_LOGGER.info("Check overclock");
+ }
+ if (GT_Values.D1) {
+ GT_FML_LOGGER.info("Find available recipe");
+ }
+ return tRecipe;
+ }
+
+ private boolean hasAllFluids(GT_Recipe.GT_Recipe_AssemblyLine tRecipe) {
+ int aFluidCount = tRecipe.mFluidInputs.length;
+ for (int i = 0; i < aFluidCount; i++) {
+ GT_MetaTileEntity_Hatch_Input tInputHatch = mInputHatches.get(i);
+ if (!isValidMetaTileEntity(tInputHatch)) {
+ return false;
+ }
+ FluidStack drained = tInputHatch.drain(ForgeDirection.UNKNOWN, tRecipe.mFluidInputs[i], false);
+ if (drained == null || drained.amount < tRecipe.mFluidInputs[i].amount) {
+ return false;
+ }
+ if (GT_Values.D1) {
+ GT_FML_LOGGER.info("Fluid:" + i + " accepted");
+ }
+ }
+ return true;
+ }
+
+ // this is only called when all slices have finished their work
+ // and the first slice cannot find a input/fluid cannot be found
+ // so we are safe to assume the old recipe no longer works
+ @Override
+ public boolean checkRecipe(ItemStack aStack) {
+ if (GT_Values.D1) {
+ GT_FML_LOGGER.info("Start ALine recipe check");
+ }
+ clearCurrentRecipe();
+ ArrayList<ItemStack> tDataStickList = getDataItems(2);
+ if (tDataStickList.isEmpty()) {
+ return false;
+ }
+ if (GT_Values.D1) {
+ GT_FML_LOGGER.info("Stick accepted, " + tDataStickList.size() + " Data Sticks found");
+ }
+
+ GT_Recipe.GT_Recipe_AssemblyLine recipe = null;
+ for (ItemStack stack : tDataStickList) {
+ recipe = findRecipe(stack);
+ if (recipe != null) {
+ setCurrentRecipe(stack, recipe);
+ calculateOverclockedNessMulti(currentRecipe.mEUt, Math.max(recipe.mDuration / recipe.mInputs.length, 1), 1, inputVoltage);
+ // correct the recipe duration
+ mMaxProgresstime *= recipe.mInputs.length;
+ // In case recipe is too OP for that machine
+ if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) {
+ if (GT_Values.D1) {
+ GT_FML_LOGGER.info("Recipe too OP");
+ }
+ continue;
+ }
+ break;
+ }
+ }
+
+ if (recipe == null) {
+ if (GT_Values.D1) {
+ GT_FML_LOGGER.info("Did not find a recipe");
+ }
+ return false;
+ }
+
+ if (GT_Values.D1) {
+ GT_FML_LOGGER.info("All checked start consuming inputs");
+ }
+
+ if (!slices[0].start()) {
+ clearCurrentRecipe();
+ // something very very wrong...
+ return false;
+ }
+ drainAllFluids(recipe);
+
+ mOutputItems = new ItemStack[]{recipe.mOutput};
+
+ if (this.mEUt > 0) {
+ this.mEUt = -this.mEUt;
+ }
+ baseEUt = mEUt;
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+ updateSlots();
+
+ if (GT_Values.D1) {
+ GT_FML_LOGGER.info("Recipe successful");
+ }
+ return true;
+ }
+
+ @Override
+ 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"));
+ 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;
+ for (int i = 0, listSize = list.size(); i < listSize; i++) {
+ NBTTagInt t = list.get(i);
+ int progress = t.func_150287_d();
+ if (progress > 20) {
+ currentTip.add(I18n.format("ggfab.waila.advassline.slice", i, progress / 20, duration / 20));
+ } else if (progress > 0) {
+ currentTip.add(I18n.format("ggfab.waila.advassline.slice.small", i, progress));
+ } else if (progress == 0) {
+ currentTip.add(I18n.format("ggfab.waila.advassline.slice.stuck", i));
+ } else
+ currentTip.add(I18n.format("ggfab.waila.advassline.slice.idle", i));
+ }
+ }
+ }
+
+ @Override
+ 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();
+ for (int i = 0; i < currentRecipe.mInputs.length; i++) {
+ l.appendTag(new NBTTagInt(slices[i].progress));
+ }
+ tag.setTag(TAG_KEY_PROGRESS_TIMES, l);
+ tag.setInteger("mDuration", currentRecipe.mDuration / currentRecipe.mInputs.length);
+ }
+
+ private void drainAllFluids(GT_Recipe.GT_Recipe_AssemblyLine recipe) {
+ for (int i = 0; i < recipe.mFluidInputs.length; i++) {
+ depleteInput(recipe.mFluidInputs[i]);
+ }
+ }
+
+ @Override
+ public void stopMachine() {
+ for (Slice slice : slices) {
+ slice.reset();
+ }
+ super.stopMachine();
+ }
+
+ private static int isStackValidIngredient(ItemStack aSlotStack, ItemStack aIngredient, ItemStack[] alts) {
+ if (alts == null || alts.length == 0) return isStackValidIngredient(aSlotStack, aIngredient);
+ for (ItemStack tAltStack : alts) {
+ int i = isStackValidIngredient(aSlotStack, tAltStack);
+ if (i >= 0) return i;
+ }
+ return -1;
+ }
+
+ private static int isStackValidIngredient(ItemStack aSlotStack, ItemStack aIngredient) {
+ if (GT_Utility.areStacksEqual(aSlotStack, aIngredient, true) && aIngredient.stackSize <= aSlotStack.stackSize)
+ return aIngredient.stackSize;
+ return -1;
+ }
+
+ private class Slice {
+ private final int id;
+ private int progress = -1;
+
+ public Slice(int id) {
+ this.id = id;
+ }
+
+ public void reset() {
+ progress = -1;
+ }
+
+ public void tick() {
+ 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;
+ }
+ }
+ }
+
+ public boolean start() {
+ 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;
+ progress = mMaxProgresstime / currentRecipe.mInputs.length;
+ stack.stackSize -= size;
+ bus.updateSlots();
+ return true;
+ }
+
+ public boolean canStart() {
+ if (progress >= 0) {
+ return false;
+ }
+ return hasInput();
+ }
+
+ public boolean hasInput() {
+ ItemStack stack = mInputBusses.get(id).getStackInSlot(0);
+ return isStackValidIngredient(stack, currentRecipe.mInputs[id], currentRecipe.mOreDictAlt[id]) >= 0;
+ }
+
+ @Override
+ public String toString() {
+ return "Slice{" +
+ "id=" + id +
+ ", progress=" + progress +
+ '}';
+ }
+ }
+}
diff --git a/src/main/resources/META-INF/ggfab_at.cfg b/src/main/resources/META-INF/ggfab_at.cfg
new file mode 100644
index 0000000000..4c03ad5bee
--- /dev/null
+++ b/src/main/resources/META-INF/ggfab_at.cfg
@@ -0,0 +1 @@
+public net.minecraft.nbt.NBTTagList field_74747_a # tagList \ No newline at end of file
diff --git a/src/main/resources/assets/ggfab/lang/en_US.lang b/src/main/resources/assets/ggfab/lang/en_US.lang
new file mode 100644
index 0000000000..a8f72df14d
--- /dev/null
+++ b/src/main/resources/assets/ggfab/lang/en_US.lang
@@ -0,0 +1,4 @@
+ggfab.waila.advassline.slice=Slice %s: %s s/%s s
+ggfab.waila.advassline.slice.small=Slice %s: %s ticks remaining
+ggfab.waila.advassline.slice.idle=Slice %s: Idle
+ggfab.waila.advassline.slice.stuck=Slice %s: ยง4STUCK \ No newline at end of file
diff --git a/src/main/resources/assets/ggfab/textures/blocks/iconsets/OVERLAY_FRONT_ADV_ASSLINE.png b/src/main/resources/assets/ggfab/textures/blocks/iconsets/OVERLAY_FRONT_ADV_ASSLINE.png
new file mode 100644
index 0000000000..da0ce84a35
--- /dev/null
+++ b/src/main/resources/assets/ggfab/textures/blocks/iconsets/OVERLAY_FRONT_ADV_ASSLINE.png
Binary files differ
diff --git a/src/main/resources/assets/ggfab/textures/blocks/iconsets/OVERLAY_FRONT_ADV_ASSLINE_ACTIVE.png b/src/main/resources/assets/ggfab/textures/blocks/iconsets/OVERLAY_FRONT_ADV_ASSLINE_ACTIVE.png
new file mode 100644
index 0000000000..89277c79d6
--- /dev/null
+++ b/src/main/resources/assets/ggfab/textures/blocks/iconsets/OVERLAY_FRONT_ADV_ASSLINE_ACTIVE.png
Binary files differ
diff --git a/src/main/resources/assets/ggfab/textures/blocks/iconsets/OVERLAY_FRONT_ADV_ASSLINE_ACTIVE_GLOW.png b/src/main/resources/assets/ggfab/textures/blocks/iconsets/OVERLAY_FRONT_ADV_ASSLINE_ACTIVE_GLOW.png
new file mode 100644
index 0000000000..4a8ad42dd8
--- /dev/null
+++ b/src/main/resources/assets/ggfab/textures/blocks/iconsets/OVERLAY_FRONT_ADV_ASSLINE_ACTIVE_GLOW.png
Binary files differ
diff --git a/src/main/resources/assets/ggfab/textures/blocks/iconsets/OVERLAY_FRONT_ADV_ASSLINE_GLOW.png b/src/main/resources/assets/ggfab/textures/blocks/iconsets/OVERLAY_FRONT_ADV_ASSLINE_GLOW.png
new file mode 100644
index 0000000000..1227d5a7fd
--- /dev/null
+++ b/src/main/resources/assets/ggfab/textures/blocks/iconsets/OVERLAY_FRONT_ADV_ASSLINE_GLOW.png
Binary files differ
diff --git a/src/main/resources/assets/ggfab/textures/blocks/iconsets/OVERLAY_FRONT_ADV_ASSLINE_STUCK.png b/src/main/resources/assets/ggfab/textures/blocks/iconsets/OVERLAY_FRONT_ADV_ASSLINE_STUCK.png
new file mode 100644
index 0000000000..1c6e16c428
--- /dev/null
+++ b/src/main/resources/assets/ggfab/textures/blocks/iconsets/OVERLAY_FRONT_ADV_ASSLINE_STUCK.png
Binary files differ
diff --git a/src/main/resources/assets/ggfab/textures/blocks/iconsets/OVERLAY_FRONT_ADV_ASSLINE_STUCK_GLOW.png b/src/main/resources/assets/ggfab/textures/blocks/iconsets/OVERLAY_FRONT_ADV_ASSLINE_STUCK_GLOW.png
new file mode 100644
index 0000000000..f5e67e7668
--- /dev/null
+++ b/src/main/resources/assets/ggfab/textures/blocks/iconsets/OVERLAY_FRONT_ADV_ASSLINE_STUCK_GLOW.png
Binary files differ