Skip to content

Commit

Permalink
Add 1.19.4 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Ampflower committed Sep 25, 2023
1 parent c200f42 commit b6c01d7
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
org.gradle.jvmargs=-Xmx1G

# Mod Properties
projectVersion=4.0.0
projectVersion=4.0.1
maven_group=gay.ampflower.mod

curseforgeId=914551
Expand Down
2 changes: 1 addition & 1 deletion libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Minecraft
minecraft_version = "1.19.2"
minecraft_required = "1.17"
minecraft_compatible = "1.17,1.17.1,1.18,1.18.1,1.18.2,1.19,1.19.1,1.19.2,1.19.3"
minecraft_compatible = "1.17,1.17.1,1.18,1.18.1,1.18.2,1.19,1.19.1,1.19.2,1.19.3,1.19.4"

fabric_loader = "0.14.21"

Expand Down
4 changes: 3 additions & 1 deletion src/main/java/tfar/fastbench/MixinHooks.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.level.Level;
import tfar.fastbench.interfaces.CraftingInventoryDuck;
import tfar.fastbench.interfaces.RecipeCoercer;
import tfar.fastbench.mixin.ContainerAccessor;

import java.util.Collections;
Expand All @@ -55,7 +56,8 @@ public static void slotChangedCraftingGrid(Level level, CraftingContainer inv, R
if (recipe == null || !recipe.matches(inv, level)) recipe = findRecipe(inv, level);

if (recipe != null) {
itemstack = recipe.assemble(inv);
// assemble
itemstack = ((RecipeCoercer<CraftingContainer>) recipe).method_8116(inv, level.registryAccess());
}

result.setItem(0, itemstack);
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/tfar/fastbench/interfaces/RecipeCoercer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package tfar.fastbench.interfaces;

import net.minecraft.core.RegistryAccess;
import net.minecraft.world.Container;
import net.minecraft.world.item.ItemStack;

/**
* Why support 1.19.4 out of band when you can curse your code?
*
* @author Ampflower
* @since 4.0.1
**/
public interface RecipeCoercer<C extends Container> {
default ItemStack method_8116(C container) {
return this.assemble(container);
}

ItemStack assemble(C container);

default ItemStack method_8116(C container, RegistryAccess registryAccess) {
return this.method_8116(container);
}
}
16 changes: 16 additions & 0 deletions src/main/java/tfar/fastbench/mixin/RecipeCoercerMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package tfar.fastbench.mixin;

import net.minecraft.world.Container;
import net.minecraft.world.item.crafting.Recipe;
import org.spongepowered.asm.mixin.Mixin;
import tfar.fastbench.interfaces.RecipeCoercer;

/**
* For 1.19.4 compatibility, the cursed way.
*
* @author Ampflower
* @since 4.0.1
**/
@Mixin(Recipe.class)
public interface RecipeCoercerMixin<C extends Container> extends RecipeCoercer<C> {
}
1 change: 1 addition & 0 deletions src/main/resources/quickbench.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"CraftingMenuMixin",
"CraftingResultSlotMixin",
"PlayerContainerMixin",
"RecipeCoercerMixin",
"RecipeManagerMixin",
"ServerPlaceRecipeMixin"
],
Expand Down

0 comments on commit b6c01d7

Please sign in to comment.