Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

Commit

Permalink
Migrate to new RecipeMap (#375)
Browse files Browse the repository at this point in the history
* Convert manual LCR recipe addition to RA2

* Remove outdated recipe addition for replicator

* Remove DynamicGTRecipe constructor that is identical to super

* Remove duplicated replicator recipe generation

* Migrate BW recipemaps

* Migrate recipe loaders

* Remove enforceNobleGas
No material succeeds in this method in the modpack

* Apply recipe categories

* Fix recipe removal code

* Adjust recipe catalysts

* update bs+deps+gradle

* fix

* fix

* change back to gtnh tag

---------

Co-authored-by: Martin Robertz <[email protected]>
Former-commit-id: 3c91fe83d0620dc1d3933f569101645351005add
  • Loading branch information
miozune and Dream-Master authored Dec 3, 2023
1 parent 95b4384 commit 9cf3651
Show file tree
Hide file tree
Showing 76 changed files with 1,041 additions and 1,720 deletions.
23 changes: 4 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//version: 1700844281
//version: 1701530445
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
Expand Down Expand Up @@ -28,27 +28,12 @@ import java.util.concurrent.TimeUnit

buildscript {
repositories {
mavenCentral()

maven {
name 'forge'
url 'https://maven.minecraftforge.net'
}
maven {
// GTNH RetroFuturaGradle and ASM Fork
name "GTNH Maven"
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
allowInsecureProtocol = true
}
maven {
name 'sonatype'
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
maven {
name 'Scala CI dependencies'
url 'https://repo1.maven.org/maven2/'
}

mavenLocal()
}
}
Expand Down Expand Up @@ -793,12 +778,12 @@ ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies"
}

dependencies {
def lwjgl3ifyVersion = '1.5.1'
def lwjgl3ifyVersion = '1.5.7'
if (modId != 'lwjgl3ify') {
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
}
if (modId != 'hodgepodge') {
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.3.17')
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.3.35')
}

java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") {transitive = false}
Expand Down Expand Up @@ -1310,7 +1295,7 @@ def addCurseForgeRelation(String type, String name) {

// Updating

def buildscriptGradleVersion = "8.2.1"
def buildscriptGradleVersion = "8.5"

tasks.named('wrapper', Wrapper).configure {
gradleVersion = buildscriptGradleVersion
Expand Down
6 changes: 3 additions & 3 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Add your dependencies here

dependencies {
api('com.github.GTNewHorizons:GT5-Unofficial:5.09.44.91:dev')
api("com.github.GTNewHorizons:TecTech:5.3.15:dev")
api('com.github.GTNewHorizons:GT5-Unofficial:5.09.44.96:dev')
api("com.github.GTNewHorizons:TecTech:5.3.18:dev")
api("com.github.GTNewHorizons:GalacticGregGT5:1.0.10:dev") {
exclude group:"com.github.GTNewHorizons", module:"bartworks"
}
api("com.github.GTNewHorizons:Avaritia:1.46:dev")
implementation("com.github.GTNewHorizons:TinkersConstruct:1.10.12-GTNH:dev")

compileOnly("com.github.GTNewHorizons:TinkersGregworks:GTNH-1.0.24-pre:dev") {transitive = false}
compileOnly("com.github.GTNewHorizons:TinkersGregworks:GTNH-1.0.25-pre:dev") {transitive = false}
compileOnly("com.github.GTNewHorizons:OpenComputers:1.9.19-GTNH:api") {transitive = false}
}
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
5 changes: 4 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
package com.github.bartimaeusnek.bartworks.API;

import static gregtech.api.enums.Mods.Gendustry;
import static gregtech.api.util.GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes;
import static gregtech.api.recipe.RecipeMaps.centrifugeRecipes;
import static gregtech.api.util.GT_RecipeBuilder.SECONDS;

import java.awt.Color;
Expand Down Expand Up @@ -177,7 +177,7 @@ public static void regenerateBioFluids() {

GT_Values.RA.stdBuilder().itemInputs(GT_Utility.getIntegratedCircuit(10))
.fluidInputs(new FluidStack(B.getFluid(), 1000)).fluidOutputs(dnaFluid).duration(25 * SECONDS)
.eut(TierEU.RECIPE_MV).addTo(sCentrifugeRecipes);
.eut(TierEU.RECIPE_MV).addTo(centrifugeRecipes);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,46 +123,4 @@ public static boolean addBacterialVatRecipe(ItemStack[] aInputs, @Nonnull BioCul
aSpecialValue,
exactSv);
}

// public static boolean addBacterialVatRecipe(ItemStack[] aInputs, ItemStack[] aOutputs, FluidStack[]
// aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSievert) {
// return BWRecipes.instance.addBacterialVatRecipe(aInputs, aOutputs, aFluidInputs, aFluidOutputs, aDuration,
// aEUt, aSievert);
// }

// @Deprecated
// public static boolean addBioLabRecipeDNAExtraction(ItemStack[] aInputs, ItemStack aOutput, int[] aChances,
// FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue){
// return BWRecipes.instance.addBioLabRecipeDNAExtraction(aInputs, aOutput, aChances, aFluidInputs,
// aFluidOutputs, aDuration, aEUt, aSpecialValue);
// }
//
// @Deprecated
// public static boolean addBioLabRecipePCRThermoclycling(ItemStack[] aInputs, ItemStack aOutput, int[] aChances,
// FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue){
// return BWRecipes.instance.addBioLabRecipePCRThermoclycling(aInputs, aOutput, aChances, aFluidInputs,
// aFluidOutputs, aDuration, aEUt, aSpecialValue);
// }
//
// @Deprecated
// public static boolean addBioLabRecipePlasmidSynthesis(ItemStack[] aInputs, ItemStack aOutput, int[] aChances,
// FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue){
// return BWRecipes.instance.addBioLabRecipePlasmidSynthesis(aInputs, aOutput, aChances, aFluidInputs,
// aFluidOutputs, aDuration, aEUt, aSpecialValue);
// }
//
// @Deprecated
// public static boolean addBioLabRecipeTransformation(ItemStack[] aInputs, ItemStack aOutput, int[] aChances,
// FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue){
// return BWRecipes.instance.addBioLabRecipeTransformation(aInputs, aOutput, aChances, aFluidInputs,
// aFluidOutputs, aDuration, aEUt, aSpecialValue);
// }
//
// @Deprecated
// public static boolean addBioLabRecipeClonalCellularSynthesis(ItemStack[] aInputs, ItemStack aOutput, int[]
// aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue){
// return BWRecipes.instance.addBioLabRecipeClonalCellularSynthesis(aInputs, aOutput, aChances, aFluidInputs,
// aFluidOutputs, aDuration, aEUt, aSpecialValue);
// }

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package com.github.bartimaeusnek.bartworks.API.recipe;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.world.World;

import com.github.bartimaeusnek.bartworks.util.BW_Util;

public class BWNBTDependantCraftingRecipe implements IRecipe {

ItemStack result;
Map<Character, ItemStack> charToStackMap = new HashMap<>(9, 1);
String[] shape;

@SuppressWarnings({ "SuspiciousSystemArraycopy" })
public BWNBTDependantCraftingRecipe(ItemStack result, Object... recipe) {
this.result = result;
this.shape = new String[3];
System.arraycopy(recipe, 0, this.shape, 0, 3);
this.charToStackMap.put(' ', null);
for (int i = 3; i < recipe.length; i += 2) {
this.charToStackMap.put((char) recipe[i], ((ItemStack) recipe[i + 1]).copy());
}
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof BWNBTDependantCraftingRecipe that)) return false;

if (!Objects.equals(this.result, that.result) || !Objects.equals(this.charToStackMap, that.charToStackMap))
return false;
// Probably incorrect - comparing Object[] arrays with Arrays.equals
return Arrays.equals(this.shape, that.shape);
}

@Override
public int hashCode() {
int result1 = this.result != null ? this.result.hashCode() : 0;
result1 = 31 * result1 + (this.charToStackMap != null ? this.charToStackMap.hashCode() : 0);
return 31 * result1 + Arrays.hashCode(this.shape);
}

@Override
public boolean matches(InventoryCrafting p_77569_1_, World p_77569_2_) {
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
ItemStack toCheck = p_77569_1_.getStackInRowAndColumn(y, x);
ItemStack ref = this.charToStackMap.get(this.shape[x].toCharArray()[y]);
if (!BW_Util.areStacksEqualOrNull(toCheck, ref)) return false;
}
}
return true;
}

@Override
public ItemStack getCraftingResult(InventoryCrafting p_77572_1_) {
return this.result.copy();
}

@Override
public int getRecipeSize() {
return 10;
}

@Override
public ItemStack getRecipeOutput() {
return this.result;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package com.github.bartimaeusnek.bartworks.API.recipe;

import java.util.Arrays;
import java.util.List;

import javax.annotation.ParametersAreNonnullByDefault;

import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;

import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_BioVat;
import com.gtnewhorizons.modularui.api.math.Alignment;

import gregtech.api.recipe.BasicUIPropertiesBuilder;
import gregtech.api.recipe.NEIRecipePropertiesBuilder;
import gregtech.api.recipe.RecipeMapFrontend;
import gregtech.api.util.MethodsReturnNonnullByDefault;
import gregtech.nei.GT_NEI_DefaultHandler;
import gregtech.nei.RecipeDisplayInfo;
import gregtech.nei.formatter.INEISpecialInfoFormatter;

@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class BacterialVatFrontend extends RecipeMapFrontend {

public BacterialVatFrontend(BasicUIPropertiesBuilder uiPropertiesBuilder,
NEIRecipePropertiesBuilder neiPropertiesBuilder) {
super(
uiPropertiesBuilder,
neiPropertiesBuilder.neiSpecialInfoFormatter(new BacterialVatSpecialValueFormatter()));
}

@Override
protected List<String> handleNEIItemInputTooltip(List<String> currentTip,
GT_NEI_DefaultHandler.FixedPositionedStack pStack) {
if (pStack.isFluid()) {
currentTip.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("nei.biovat.input.tooltip"));
return currentTip;
}
return super.handleNEIItemInputTooltip(currentTip, pStack);
}

@Override
protected List<String> handleNEIItemOutputTooltip(List<String> currentTip,
GT_NEI_DefaultHandler.FixedPositionedStack pStack) {
if (pStack.isFluid()) {
currentTip.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("nei.biovat.output.tooltip"));
return currentTip;
}
return super.handleNEIItemOutputTooltip(currentTip, pStack);
}

@Override
protected void drawNEIOverlayForInput(GT_NEI_DefaultHandler.FixedPositionedStack stack) {
drawFluidOverlay(stack);
}

@Override
protected void drawNEIOverlayForOutput(GT_NEI_DefaultHandler.FixedPositionedStack stack) {
drawFluidOverlay(stack);
}

private void drawFluidOverlay(GT_NEI_DefaultHandler.FixedPositionedStack stack) {
if (stack.isFluid()) {
drawNEIOverlayText(
"+",
stack,
colorOverride.getTextColorOrDefault("nei_overlay_yellow", 0xFDD835),
0.5f,
true,
Alignment.TopRight);
return;
}
super.drawNEIOverlayForOutput(stack);
}

private static class BacterialVatSpecialValueFormatter implements INEISpecialInfoFormatter {

@Override
public List<String> format(RecipeDisplayInfo recipeInfo) {
int[] tSpecialA = GT_TileEntity_BioVat.specialValueUnpack(recipeInfo.recipe.mSpecialValue);
String glassTier = StatCollector.translateToLocalFormatted("nei.biovat.0.name", tSpecialA[0]);
String sievert;
if (tSpecialA[2] == 1) {
sievert = StatCollector.translateToLocalFormatted("nei.biovat.1.name", tSpecialA[3]);
} else {
sievert = StatCollector.translateToLocalFormatted("nei.biovat.2.name", tSpecialA[3]);
}
return Arrays.asList(glassTier, sievert);
}
}
}
Loading

0 comments on commit 9cf3651

Please sign in to comment.