Skip to content

Commit

Permalink
Migrate to FindRecipeQuery (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
miozune authored Aug 16, 2024
1 parent 2d8ac4a commit 6ab6507
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 18 deletions.
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
* For more details, see https://docs.gradle.org/7.6/userguide/java_library_plugin.html#sec:java_library_configurations_graph
*/
dependencies {
api("com.github.GTNewHorizons:GT5-Unofficial:5.09.48.97:dev")
api("com.github.GTNewHorizons:GT5-Unofficial:5.09.49.03:dev")
api("com.github.GTNewHorizons:CraftTweaker:3.3.1:dev")
}
13 changes: 12 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ accessTransformersFile =
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false

# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
# Mixin classes will have access to "main" classes, but not the other way around.
separateMixinSourceSet =

# Adds some debug arguments like verbose output and class export.
usesMixinDebug = false

Expand Down Expand Up @@ -117,9 +122,15 @@ minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true

# Adds the GTNH maven, CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
includeWellKnownRepositories = true

# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
# list of strings, with the acceptable keys being(case does not matter):
# cursemaven
# modrinth
excludeWellKnownRepositories =

# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
5 changes: 4 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pluginManagement {
}

plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.23'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.26'
}


26 changes: 13 additions & 13 deletions src/main/java/gttweaker/mods/gregtech/RecipeRemover.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ public static void remove(String map, IIngredient[] inputs, IIngredient[] fluidI
MineTweakerAPI.logError("Could not find recipe map named \"" + map + "\"");
return;
}
GT_Recipe recipe = recipeMap.findRecipe(
null,
false,
true,
Long.MAX_VALUE,
Arrays.stream(fluidInputs)
.map(GTTweaker::getFluidStackOrNull)
.filter(Objects::nonNull)
.toArray(FluidStack[]::new),
Arrays.stream(inputs)
.map(GTTweaker::getItemStackOrNull)
.filter(Objects::nonNull)
.toArray(ItemStack[]::new));
GT_Recipe recipe = recipeMap.findRecipeQuery()
.items(
Arrays.stream(inputs)
.map(GTTweaker::getItemStackOrNull)
.filter(Objects::nonNull)
.toArray(ItemStack[]::new))
.fluids(
Arrays.stream(fluidInputs)
.map(GTTweaker::getFluidStackOrNull)
.filter(Objects::nonNull)
.toArray(FluidStack[]::new))
.dontCheckStackSizes(true)
.find();
if (recipe == null) {
MineTweakerAPI.logWarning("Could not find recipe to remove!");
return;
Expand Down

0 comments on commit 6ab6507

Please sign in to comment.