aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorMadMan310 <66886359+MadMan310@users.noreply.github.com>2023-02-26 03:21:50 -0800
committerGitHub <noreply@github.com>2023-02-26 12:21:50 +0100
commita8ecbb08f1397d822729c8b6b62301dc405e3c25 (patch)
treebd7504d16fde3991b0968c4545bbcf51ba778224 /src/main/java
parent33feb06f8c9d5ebd5aeb5a03dcdb8f5d3bd73d06 (diff)
downloadGT5-Unofficial-a8ecbb08f1397d822729c8b6b62301dc405e3c25.tar.gz
GT5-Unofficial-a8ecbb08f1397d822729c8b6b62301dc405e3c25.tar.bz2
GT5-Unofficial-a8ecbb08f1397d822729c8b6b62301dc405e3c25.zip
More CoAL improvements (#136)
* Update TecTech Dependency * Add more item and fluid slots to the CoAL map * More Input Bus candidates * Add separate input bus capability * Spotless * NEI fix * tooltip fix * merge master (#139) * Update buildscript, fix missing windows gradle wrapper * Add alternative recipe to circuits (#137) * Make PrAss Accept EV+ glass (#138) * Add alternative recipe to circuits * Add glass Variants to PrAss --------- Co-authored-by: Raven Szewczyk <git@eigenraven.me> Co-authored-by: LewisSaber <39595617+LewisSaber@users.noreply.github.com> * Recipe duration and power is 64x +cleanup * power+time req is 64x for LV-IV components * added support for new GUI buttons --------- Co-authored-by: Martin Robertz <dream-master@gmx.net> Co-authored-by: Raven Szewczyk <git@eigenraven.me> Co-authored-by: LewisSaber <39595617+LewisSaber@users.noreply.github.com>
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/goodgenerator/blocks/tileEntity/ComponentAssemblyLine.java65
-rw-r--r--src/main/java/goodgenerator/loader/ComponentAssemblyLineRecipeLoader.java24
-rw-r--r--src/main/java/goodgenerator/util/MyRecipeAdder.java13
-rw-r--r--src/main/java/goodgenerator/util/StackUtils.java10
4 files changed, 82 insertions, 30 deletions
diff --git a/src/main/java/goodgenerator/blocks/tileEntity/ComponentAssemblyLine.java b/src/main/java/goodgenerator/blocks/tileEntity/ComponentAssemblyLine.java
index 991903b130..4907f731f3 100644
--- a/src/main/java/goodgenerator/blocks/tileEntity/ComponentAssemblyLine.java
+++ b/src/main/java/goodgenerator/blocks/tileEntity/ComponentAssemblyLine.java
@@ -1,12 +1,15 @@
package goodgenerator.blocks.tileEntity;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static goodgenerator.util.DescTextLocalization.BLUE_PRINT_INFO;
import static gregtech.api.enums.GT_HatchElement.*;
import static gregtech.api.enums.Textures.BlockIcons.*;
+import java.util.ArrayList;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
+import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
@@ -30,10 +33,12 @@ import gregtech.api.enums.Textures;
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_InputBus;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_StructureUtility;
+import gregtech.api.util.GT_Utility;
public class ComponentAssemblyLine extends GT_MetaTileEntity_LongPowerUsageBase<ComponentAssemblyLine>
implements ISurvivalConstructable {
@@ -47,9 +52,9 @@ public class ComponentAssemblyLine extends GT_MetaTileEntity_LongPowerUsageBase<
STRUCTURE_PIECE_MAIN,
new String[][] {
{ " ", " III ", " HHI~IHH ", "HH III HH", "H H", "H H", "H JJJ H",
- "H N N H", "H N N H", "HHHHHHHHH" },
- { " ", " EHHHHHE ", "E E", "H H", "A A", "A A", "A HHH A",
- "A A", "A A", "MHHHHHHHM" },
+ "H JJJ H", "H N N H", "HHHHHHHHH" },
+ { " ", " EHHHHHE ", "E E", "H H", "A A", "A A", "A A",
+ "A HHH A", "A A", "MHHHHHHHM" },
{ " HBH ", " EL LE ", "E E", "HC CH", "AC CA", "AC CA", "A D D A",
"A HHH A", "A A", "MHHHHHHHM" },
{ " HBH ", " EL LE ", "E E", "H H", "A A", "A A", "A A",
@@ -184,10 +189,10 @@ public class ComponentAssemblyLine extends GT_MetaTileEntity_LongPowerUsageBase<
.addInfo(
"The " + EnumChatFormatting.BOLD
+ EnumChatFormatting.YELLOW
- + "Special Component Assembly Line Casing"
+ + "Component Assembly Line Casing "
+ EnumChatFormatting.RESET
- + EnumChatFormatting.GRAY)
- .addInfo("limits the recipes the machine can perform. See the NEI pages for details.")
+ + EnumChatFormatting.GRAY
+ + "limits the recipes the machine can perform. See the NEI pages for details.")
.addInfo(
"Supports " + EnumChatFormatting.BLUE
+ "Tec"
@@ -197,6 +202,7 @@ public class ComponentAssemblyLine extends GT_MetaTileEntity_LongPowerUsageBase<
+ " laser and multi-amp hatches!")
.addInfo("Supports overclocking beyond MAX!")
.addInfo(EnumChatFormatting.ITALIC + "Much more efficient than other competing brands!")
+ .addInfo("The structure is too complex!").addInfo(BLUE_PRINT_INFO).addSeparator()
.beginStructureBlock(9, 10, 33, false)
.addStructureInfo("This structure is too complex! See schematic for details.")
.addOtherStructurePart("Borosilicate Glass", "Can be UV tier or higher")
@@ -254,14 +260,33 @@ public class ComponentAssemblyLine extends GT_MetaTileEntity_LongPowerUsageBase<
public boolean checkRecipe(ItemStack aStack) {
this.mEfficiencyIncrease = 10000;
this.mEfficiency = (10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000);
- long totalEU = getRealVoltage();
- ItemStack[] tItems = getStoredInputs().toArray(new ItemStack[0]);
FluidStack[] tFluids = getStoredFluids().toArray(new FluidStack[0]);
+
+ if (inputSeparation) {
+ ArrayList<ItemStack> tInputList = new ArrayList<>();
+ for (GT_MetaTileEntity_Hatch_InputBus tHatch : mInputBusses) {
+ IGregTechTileEntity tInputBus = tHatch.getBaseMetaTileEntity();
+ for (int i = tInputBus.getSizeInventory() - 1; i >= 0; i--) {
+ if (tInputBus.getStackInSlot(i) != null) tInputList.add(tInputBus.getStackInSlot(i));
+ }
+ ItemStack[] tInputs = tInputList.toArray(new ItemStack[0]);
+ if (processRecipe(tInputs, tFluids)) return true;
+ else tInputList.clear();
+ }
+ } else {
+ ItemStack[] tItems = getStoredInputs().toArray(new ItemStack[0]);
+ return processRecipe(tItems, tFluids);
+ }
+ return false;
+ }
+
+ private boolean processRecipe(ItemStack[] tInputs, FluidStack[] tFluidInputs) {
+ long totalEU = getRealVoltage();
this.lastRecipe = getRecipeMap()
- .findRecipe(getBaseMetaTileEntity(), this.lastRecipe, false, totalEU, tFluids, tItems);
+ .findRecipe(getBaseMetaTileEntity(), this.lastRecipe, false, totalEU, tFluidInputs, tInputs);
if (this.lastRecipe == null) return false;
if (this.lastRecipe.mSpecialValue > casingTier + 1) return false;
- if (!this.lastRecipe.isRecipeInputEqual(true, tFluids, tItems)) return false;
+ if (!this.lastRecipe.isRecipeInputEqual(true, tFluidInputs, tInputs)) return false;
calculateOverclockedNessMulti((long) this.lastRecipe.mEUt, this.lastRecipe.mDuration, 1, totalEU);
if (this.lEUt > 0) {
@@ -286,6 +311,19 @@ public class ComponentAssemblyLine extends GT_MetaTileEntity_LongPowerUsageBase<
}
@Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ inputSeparation = !inputSeparation;
+ GT_Utility.sendChatToPlayer(
+ aPlayer,
+ StatCollector.translateToLocal("GT5U.machines.separatebus") + " " + inputSeparation);
+ }
+
+ @Override
+ protected boolean isInputSeparationButtonEnabled() {
+ return true;
+ }
+
+ @Override
public int getMaxEfficiency(ItemStack aStack) {
return 10000;
}
@@ -307,13 +345,16 @@ public class ComponentAssemblyLine extends GT_MetaTileEntity_LongPowerUsageBase<
@Override
public void saveNBTData(NBTTagCompound aNBT) {
- aNBT.setInteger("casingTier", casingTier);
super.saveNBTData(aNBT);
+ aNBT.setInteger("casingTier", casingTier);
}
@Override
public void loadNBTData(final NBTTagCompound aNBT) {
- casingTier = aNBT.getInteger("casingTier");
super.loadNBTData(aNBT);
+ casingTier = aNBT.getInteger("casingTier");
+ if (!aNBT.hasKey(INPUT_SEPARATION_NBT_KEY)) {
+ inputSeparation = aNBT.getBoolean("mSeparate");
+ }
}
}
diff --git a/src/main/java/goodgenerator/loader/ComponentAssemblyLineRecipeLoader.java b/src/main/java/goodgenerator/loader/ComponentAssemblyLineRecipeLoader.java
index ced594689e..6a2c5a8878 100644
--- a/src/main/java/goodgenerator/loader/ComponentAssemblyLineRecipeLoader.java
+++ b/src/main/java/goodgenerator/loader/ComponentAssemblyLineRecipeLoader.java
@@ -84,8 +84,8 @@ public class ComponentAssemblyLineRecipeLoader {
compactItems(fixedInputs, info.getRight()).toArray(new ItemStack[0]),
fixedFluids.toArray(new FluidStack[0]),
info.getLeft().get(OUTPUT_MULTIPLIER),
- recipe.mDuration * INPUT_MULTIPLIER,
- energy,
+ recipe.mDuration * OUTPUT_MULTIPLIER,
+ energy * OUTPUT_MULTIPLIER,
info.getRight());
}
}
@@ -143,15 +143,19 @@ public class ComponentAssemblyLineRecipeLoader {
MyRecipeAdder.instance.addComponentAssemblyLineRecipe(
fixedInputs.toArray(new ItemStack[0]),
fixedFluids.toArray(new FluidStack[0]),
- info.getLeft().get(OUTPUT_MULTIPLIER),
- recipe.mDuration,
- recipe.mEUt,
- info.getRight());
+ info.getLeft().get(OUTPUT_MULTIPLIER), // The component output
+ recipe.mDuration * OUTPUT_MULTIPLIER, // Takes as long as this many
+ recipe.mEUt * OUTPUT_MULTIPLIER, // Takes the power of this many
+ info.getRight()); // Casing tier
}
}
});
}
+ /**
+ * Looks for a matching FluidStack and merges the amount of the converted fluid with the one it found. Otherwise, it
+ * will add the converted to the fluid inputs.
+ */
private static void replaceIntoFluids(List<ItemStack> inputs, List<FluidStack> fluidOutputs, int threshold) {
HashMap<ItemStack, Integer> totals = getTotalItems(inputs.toArray(new ItemStack[0]));
ArrayList<ItemStack> newInputs = new ArrayList<>();
@@ -160,13 +164,11 @@ public class ComponentAssemblyLineRecipeLoader {
boolean isConverted = false;
if (OreDictionary.getOreIDs(input).length > 0 && count > threshold) {
FluidStack foundFluidStack = tryConvertItemStackToFluidMaterial(input);
- // Looks for a matching fluid stack and merges the amount of the converted fluid with
- // the one it found. Otherwise it will add the converted to the fluid inputs.
+
+ ItemData data = GT_OreDictUnificator.getAssociation(input);
// Prevents the uncraftable molten magnetic samarium from being converted into fluid during auto
// generation
-
- ItemData data = GT_OreDictUnificator.getAssociation(input);
if (data != null && data.mMaterial.mMaterial == Materials.SamariumMagnetic) {
input = GT_OreDictUnificator.get(data.mPrefix, Materials.Samarium, 1);
foundFluidStack = tryConvertItemStackToFluidMaterial(input);
@@ -244,7 +246,7 @@ public class ComponentAssemblyLineRecipeLoader {
* For example: If your OreDictionary is something like {@code gearGtSmallSpaceTime}, a conventional search would
* return something like {@code gearGt} instead of {@code gearGtSmall}. This makes the longer String the most
* accurate.
- *
+ *
* @param oreDict The Ore Dictionary entry
* @return The longest ore prefix that the OreDict string starts with. This makes it the most accurate prefix.
*/
diff --git a/src/main/java/goodgenerator/util/MyRecipeAdder.java b/src/main/java/goodgenerator/util/MyRecipeAdder.java
index ce63af69ae..f5aad4cb00 100644
--- a/src/main/java/goodgenerator/util/MyRecipeAdder.java
+++ b/src/main/java/goodgenerator/util/MyRecipeAdder.java
@@ -515,7 +515,7 @@ public class MyRecipeAdder {
aNEISpecialValuePost,
aShowVoltageAmperageInNEI,
aNEIAllowed);
- setUsualFluidInputCount(8);
+ setUsualFluidInputCount(12);
setNEITransferRect(new Rectangle(70, 15, 18, 54));
setNEISpecialInfoFormatter(
(recipeInfo, applyPrefixAndSuffix) -> Collections.singletonList(
@@ -524,17 +524,18 @@ public class MyRecipeAdder {
@Override
public List<Pos2d> getItemInputPositions(int itemInputCount) {
- return UIHelper.getGridPositions(itemInputCount, 16, 15, 3);
+ return UIHelper.getGridPositions(itemInputCount, 16, 8, 3);
}
@Override
public List<Pos2d> getItemOutputPositions(int itemOutputCount) {
- return Collections.singletonList(new Pos2d(142, 15));
+ return Collections.singletonList(new Pos2d(142, 8));
}
@Override
public List<Pos2d> getFluidInputPositions(int fluidInputCount) {
- return UIHelper.getGridPositions(fluidInputCount, 88, 37, 4);
+
+ return UIHelper.getGridPositions(fluidInputCount, 88, 26, 4);
}
@Override
@@ -545,7 +546,7 @@ public class MyRecipeAdder {
Pos2d windowOffset) {
builder.widget(
new DrawableWidget().setDrawable(GG_UITextures.PICTURE_COMPONENT_ASSLINE)
- .setPos(new Pos2d(70, 22).add(windowOffset)).setSize(72, 40));
+ .setPos(new Pos2d(70, 11).add(windowOffset)).setSize(72, 40));
}
}
@@ -555,7 +556,7 @@ public class MyRecipeAdder {
"Component Assembly Line",
null,
"goodgenerator:textures/gui/ComponentAssline",
- 9,
+ 12,
1,
0,
0,
diff --git a/src/main/java/goodgenerator/util/StackUtils.java b/src/main/java/goodgenerator/util/StackUtils.java
index c4d8c4f9a1..3de85910cb 100644
--- a/src/main/java/goodgenerator/util/StackUtils.java
+++ b/src/main/java/goodgenerator/util/StackUtils.java
@@ -16,7 +16,7 @@ public class StackUtils {
/**
* Multiplies one ItemStack by a multiplier, and splits it into as many full stacks as it needs to.
- *
+ *
* @param stack The ItemStack you want to multiply
* @param multiplier The number the stack is multiplied by
* @return A List of stacks that, in total, are the same as the input ItemStack after it has been multiplied.
@@ -67,6 +67,10 @@ public class StackUtils {
return output;
}
+ /**
+ * Turns the {@code items} List into a {@code HashMap} containing each unique {@code ItemStack} as the key, and a
+ * value representing the total amount of the respective {@code ItemStack} in the List.
+ */
public static HashMap<ItemStack, Integer> getTotalItems(List<ItemStack> items) {
HashMap<ItemStack, Integer> totals = new HashMap<>();
itemLoop: for (ItemStack item : items) {
@@ -77,6 +81,10 @@ public class StackUtils {
return totals;
}
+ /**
+ * Turns the {@code items} Array into a {@code HashMap} containing each unique {@code ItemStack} as the key, and a
+ * value representing the total amount of the respective {@code ItemStack} in the Array.
+ */
public static HashMap<ItemStack, Integer> getTotalItems(ItemStack[] items) {
return getTotalItems(Arrays.asList(items));
}