diff options
author | miozune <miozune@gmail.com> | 2023-07-25 06:12:21 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-24 23:12:21 +0200 |
commit | 13b2b3f90b690f7f58659df41bc1186679f8b351 (patch) | |
tree | a50f173f54e9b2addf36afdd760552f561401191 | |
parent | a0c24b2ec4fc7371248b501f520e71e21f9d529b (diff) | |
download | GT5-Unofficial-13b2b3f90b690f7f58659df41bc1186679f8b351.tar.gz GT5-Unofficial-13b2b3f90b690f7f58659df41bc1186679f8b351.tar.bz2 GT5-Unofficial-13b2b3f90b690f7f58659df41bc1186679f8b351.zip |
Fix findRecipe for Elemental Duplicator (#704)
* Remove outdated script
* updateBuildScript
* Update GT
* Remove unused methods
* Fix findRecipe for Elemental Duplicator
-rwxr-xr-x | .github/scripts/test-no-error-reports.sh | 45 | ||||
-rw-r--r-- | build.gradle | 64 | ||||
-rw-r--r-- | dependencies.gradle | 2 | ||||
-rw-r--r-- | gradle/wrapper/gradle-wrapper.jar | bin | 61608 -> 62076 bytes | |||
-rw-r--r-- | gradle/wrapper/gradle-wrapper.properties | 2 | ||||
-rwxr-xr-x | gradlew | 7 | ||||
-rw-r--r-- | src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java | 196 | ||||
-rw-r--r-- | src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java | 3 |
8 files changed, 30 insertions, 289 deletions
diff --git a/.github/scripts/test-no-error-reports.sh b/.github/scripts/test-no-error-reports.sh deleted file mode 100755 index cfce0261a5..0000000000 --- a/.github/scripts/test-no-error-reports.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env bash - -RUNDIR="run" -CRASH="crash-reports" -SERVERLOG="server.log" - -# enable nullglob to get 0 results when no match rather than the pattern -shopt -s nullglob -# store matches in array (don't forget to double-quote variables expansion -crash_reports=( "$RUNDIR/$CRASH/crash"*.txt ) -if [ "${#crash_reports[@]}" -gt 0 ]; then - latest_crash_report="${crash_reports[-1]}" - { - printf 'Latest crash report detected %s:\n' "${latest_crash_report##*/}" - cat "$latest_crash_report" - } >&2 - exit 1 -fi - -if grep --quiet --fixed-strings 'Fatal errors were detected' "$SERVERLOG"; then - { - printf 'Fatal errors detected:' - cat server.log - } >&2 - exit 1 -fi - -if grep --quiet --fixed-strings 'The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED' "$SERVERLOG"; then - { - printf 'Server force stopped:' - cat server.log - } >&2 - exit 1 -fi - -if ! grep --quiet -Po '.+Done \(.+\)\! For help, type "help" or "\?"' "$SERVERLOG"; then - { - printf 'Server did not finish startup:' - cat server.log - } >&2 - exit 1 -fi - -printf 'No crash reports detected' -exit 0 diff --git a/build.gradle b/build.gradle index bd6289cf65..1aaadcce85 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1689409577 +//version: 1690104383 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. @@ -69,7 +69,7 @@ plugins { id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version id 'com.modrinth.minotaur' version '2.+' apply false id 'com.matthewprenger.cursegradle' version '1.4.0' apply false - id 'com.gtnewhorizons.retrofuturagradle' version '1.3.19' + id 'com.gtnewhorizons.retrofuturagradle' version '1.3.21' } print("You might want to check out './gradlew :faq' if your build fails.\n") @@ -575,13 +575,28 @@ repositories { } } if (includeWellKnownRepositories.toBoolean()) { - maven { - name "CurseMaven" - url "https://cursemaven.com" - content { + exclusiveContent { + forRepository { + maven { + name "CurseMaven" + url "https://cursemaven.com" + } + } + filter { includeGroup "curse.maven" } } + exclusiveContent { + forRepository { + maven { + name = "Modrinth" + url = "https://api.modrinth.com/maven" + } + } + filter { + includeGroup "maven.modrinth" + } + } maven { name = "ic2" url = "https://maven.ic2.player.to/" @@ -623,7 +638,7 @@ dependencies { } } if (usesMixins.toBoolean()) { - implementation(mixinProviderSpec) + implementation(modUtils.enableMixins(mixinProviderSpec)) } else if (forceEnableMixins.toBoolean()) { runtimeOnlyNonPublishable(mixinProviderSpec) } @@ -677,9 +692,6 @@ if (file('dependencies.gradle.kts').exists()) { } def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json' -def mixinTmpDir = buildDir.path + File.separator + 'tmp' + File.separator + 'mixins' -def refMap = "${mixinTmpDir}" + File.separator + mixingConfigRefMap -def mixinSrg = "${mixinTmpDir}" + File.separator + "mixins.srg" tasks.register('generateAssets') { group = "GTNH Buildscript" @@ -711,46 +723,17 @@ tasks.register('generateAssets') { } if (usesMixins.toBoolean()) { - tasks.named("reobfJar", ReobfuscatedJar).configure { - extraSrgFiles.from(mixinSrg) - } - tasks.named("processResources").configure { dependsOn("generateAssets") } tasks.named("compileJava", JavaCompile).configure { - doFirst { - new File(mixinTmpDir).mkdirs() - } options.compilerArgs += [ - "-AreobfSrgFile=${tasks.reobfJar.srg.get().asFile}", - "-AoutSrgFile=${mixinSrg}", - "-AoutRefMapFile=${refMap}", // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code "-XDenableSunApiLintControl", "-XDignore.symbol.file" ] } - - pluginManager.withPlugin('org.jetbrains.kotlin.kapt') { - kapt { - correctErrorTypes = true - javacOptions { - option("-AreobfSrgFile=${tasks.reobfJar.srg.get().asFile}") - option("-AoutSrgFile=$mixinSrg") - option("-AoutRefMapFile=$refMap") - } - } - tasks.configureEach { task -> - if (task.name == "kaptKotlin") { - task.doFirst { - new File(mixinTmpDir).mkdirs() - } - } - } - } - } tasks.named("processResources", ProcessResources).configure { @@ -768,7 +751,6 @@ tasks.named("processResources", ProcessResources).configure { } if (usesMixins.toBoolean()) { - from refMap dependsOn("compileJava", "compileScala") } } @@ -1311,7 +1293,7 @@ def addCurseForgeRelation(String type, String name) { // Updating -def buildscriptGradleVersion = "8.1.1" +def buildscriptGradleVersion = "8.2.1" tasks.named('wrapper', Wrapper).configure { gradleVersion = buildscriptGradleVersion diff --git a/dependencies.gradle b/dependencies.gradle index dbce7e9aa6..59b567a3f1 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,6 +1,6 @@ dependencies { - api('com.github.GTNewHorizons:GT5-Unofficial:5.09.43.139:dev') + api('com.github.GTNewHorizons:GT5-Unofficial:5.09.43.142:dev') api("com.github.GTNewHorizons:bartworks:0.7.30:dev") implementation('curse.maven:cofh-core-69162:2388751') diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar Binary files differindex ccebba7710..c1962a79e2 100644 --- a/gradle/wrapper/gradle-wrapper.jar +++ b/gradle/wrapper/gradle-wrapper.jar diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 37aef8d3f0..17a8ddce2d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists @@ -85,9 +85,6 @@ done APP_BASE_NAME=${0##*/} APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then done fi + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Collect all arguments for the java command; # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # shell script including quotes and variable substitutions, so put them in diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index f9af7d29a1..3c567db889 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -44,7 +44,6 @@ import com.gtnewhorizons.modularui.common.widget.DynamicPositionedColumn; import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; import com.gtnewhorizons.modularui.common.widget.TextWidget; -import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.enums.Textures; @@ -55,7 +54,6 @@ import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords; import gregtech.api.items.GT_MetaGenerated_Tool; import gregtech.api.logic.ProcessingLogic; import gregtech.api.metatileentity.MetaTileEntity; @@ -69,9 +67,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maint import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; -import gregtech.api.objects.GT_ItemStack; import gregtech.api.render.TextureFactory; -import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; @@ -1190,198 +1186,6 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex } /** - * Custom Find Recipe with Debugging - */ - public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final boolean aNotUnificated, - final boolean aDontCheckStackSizes, final long aVoltage, final FluidStack[] aFluids, - final ItemStack... aInputs) { - return this.findRecipe( - aTileEntity, - null, - aNotUnificated, - aDontCheckStackSizes, - aVoltage, - aFluids, - (ItemStack) null, - aInputs); - } - - public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final boolean aNotUnificated, - final long aVoltage, final FluidStack[] aFluids, final ItemStack... aInputs) { - return this.findRecipe(aTileEntity, null, aNotUnificated, aVoltage, aFluids, (ItemStack) null, aInputs); - } - - public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final GT_Recipe aRecipe, - final boolean aNotUnificated, final boolean aDontCheckStackSizes, final long aVoltage, - final FluidStack[] aFluids, final ItemStack... aInputs) { - return this.findRecipe( - aTileEntity, - aRecipe, - aNotUnificated, - aDontCheckStackSizes, - aVoltage, - aFluids, - (ItemStack) null, - aInputs); - } - - public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final GT_Recipe aRecipe, - final boolean aNotUnificated, final long aVoltage, final FluidStack[] aFluids, final ItemStack... aInputs) { - return this.findRecipe(aTileEntity, aRecipe, aNotUnificated, aVoltage, aFluids, (ItemStack) null, aInputs); - } - - public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final GT_Recipe aRecipe, - final boolean aNotUnificated, final long aVoltage, final FluidStack[] aFluids, final ItemStack aSpecialSlot, - final ItemStack... aInputs) { - return this.findRecipe(aTileEntity, aRecipe, aNotUnificated, true, aVoltage, aFluids, aSpecialSlot, aInputs); - } - - public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final GT_Recipe aRecipe, - final boolean aNotUnificated, final boolean aDontCheckStackSizes, final long aVoltage, - final FluidStack[] aFluids, final ItemStack aSpecialSlot, ItemStack... aInputs) { - if (this.getRecipeMap().mRecipeList.isEmpty()) { - log("No Recipes in Map to search through."); - return null; - } - GT_Recipe mRecipeResult = null; - try { - if (GregTech_API.sPostloadFinished) { - if (this.getRecipeMap().mMinimalInputFluids > 0) { - if (aFluids == null) { - log("aFluids == null && minFluids > 0"); - return null; - } - int tAmount = 0; - for (final FluidStack aFluid : aFluids) { - if (aFluid != null) { - ++tAmount; - } - } - if (tAmount < this.getRecipeMap().mMinimalInputFluids) { - log("Not enough fluids?"); - return null; - } - } - if (this.getRecipeMap().mMinimalInputItems > 0) { - if (aInputs == null) { - log("No inputs and minItems > 0"); - return null; - } - int tAmount = 0; - for (final ItemStack aInput : aInputs) { - if (aInput != null) { - ++tAmount; - } - } - if (tAmount < this.getRecipeMap().mMinimalInputItems) { - log("Not enough items?"); - return null; - } - } - } else { - log("Game Not Loaded properly for recipe lookup."); - } - if (aNotUnificated) { - aInputs = GT_OreDictUnificator.getStackArray(true, (Object[]) aInputs); - } - if (aRecipe != null && !aRecipe.mFakeRecipe - && aRecipe.mCanBeBuffered - && aRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) { - mRecipeResult = (aRecipe.mEnabled /* && aVoltage * this.getRecipeMap().mAmperage >= aRecipe.mEUt */) - ? aRecipe - : null; - log("x) Found Recipe? " + (mRecipeResult != null ? "true" : "false")); - if (mRecipeResult != null) { - return mRecipeResult; - } - } - if (mRecipeResult == null && this.getRecipeMap().mUsualInputCount >= 0 - && aInputs != null - && aInputs.length > 0) { - for (final ItemStack tStack : aInputs) { - if (tStack != null) { - Collection<GT_Recipe> tRecipes = this.getRecipeMap().mRecipeItemMap - .get(new GT_ItemStack(tStack)); - if (tRecipes != null) { - for (final GT_Recipe tRecipe : tRecipes) { - if (!tRecipe.mFakeRecipe - && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) { - mRecipeResult = (tRecipe.mEnabled /* - * && aVoltage * this.getRecipeMap().mAmperage >= - * tRecipe.mEUt - */) ? tRecipe : null; - log("1) Found Recipe? " + (mRecipeResult != null ? "true" : "false")); - // return mRecipeResult; - } - } - } - - // TODO - Investigate if this requires to be in it's own block - tRecipes = this.getRecipeMap().mRecipeItemMap - .get(new GT_ItemStack(GT_Utility.copyMetaData(32767L, new Object[] { tStack }))); - if (tRecipes != null) { - for (final GT_Recipe tRecipe : tRecipes) { - if (!tRecipe.mFakeRecipe - && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) { - mRecipeResult = (tRecipe.mEnabled /* - * && aVoltage * this.getRecipeMap().mAmperage >= - * tRecipe.mEUt - */) ? tRecipe : null; - log("2) Found Recipe? " + (mRecipeResult != null ? "true" : "false")); - // return mRecipeResult; - } - } - } - } - } - } - if (mRecipeResult == null && this.getRecipeMap().mMinimalInputItems == 0 - && aFluids != null - && aFluids.length > 0) { - for (final FluidStack aFluid2 : aFluids) { - if (aFluid2 != null) { - final Collection<GT_Recipe> tRecipes = this.getRecipeMap().mRecipeFluidMap - .get(aFluid2.getFluid()); - if (tRecipes != null) { - for (final GT_Recipe tRecipe : tRecipes) { - if (!tRecipe.mFakeRecipe - && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) { - mRecipeResult = (tRecipe.mEnabled /* - * && aVoltage * this.getRecipeMap().mAmperage >= - * tRecipe.mEUt - */) ? tRecipe : null; - log("3) Found Recipe? " + (mRecipeResult != null ? "true" : "false")); - // return mRecipeResult; - } - } - } - } - } - } - } catch (Throwable t) { - log("Invalid recipe lookup."); - } - - if (mRecipeResult == null) { - log( - "Invalid recipe, Fallback lookup. " + this.getRecipeMap().mRecipeList.size() - + " | " - + this.getRecipeMap().mNEIName); - return getRecipeMap().findRecipe( - aTileEntity, - aRecipe, - aNotUnificated, - aDontCheckStackSizes, - aVoltage, - aFluids, - aSpecialSlot, - aInputs); - } else { - return mRecipeResult; - } - } - - /** * Custom Tool Handling */ @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java index 4f5a9ce341..c4926f5fc7 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java @@ -395,7 +395,6 @@ public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase * @param aInputs the Item Inputs * @return the Recipe it has found or null for no matching Recipe */ - @Override public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, boolean aDontCheckStackSizes, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) { @@ -475,7 +474,7 @@ public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase // too. if (mRecipeMap.mMinimalInputItems == 0 && aFluids != null) for (FluidStack aFluid : aFluids) if (aFluid != null) { - Collection<GT_Recipe> tRecipes = mRecipeMap.mRecipeFluidMap.get(aFluid.getFluid()); + Collection<GT_Recipe> tRecipes = mRecipeMap.mRecipeFluidMap.get(aFluid.getFluid().getName()); if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) { if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) { |