mirror of
https://github.com/FabricMC/fabric.git
synced 2025-04-12 06:54:27 -04:00
Revert "Fix available stonecutting recipe recalculation not being stack-aware (#4341)"
This reverts commit339ab8c477
. (cherry picked from commit160b66fafb
)
This commit is contained in:
parent
86c3a9f167
commit
eaec5033d5
4 changed files with 1 additions and 71 deletions
fabric-recipe-api-v1/src
main
java/net/fabricmc/fabric/mixin/recipe/ingredient
resources
testmod/resources/data/fabric-recipe-api-v1-testmod/recipe
|
@ -1,49 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.fabricmc.fabric.mixin.recipe.ingredient;
|
||||
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.screen.StonecutterScreenHandler;
|
||||
|
||||
@Mixin(StonecutterScreenHandler.class)
|
||||
public class StonecutterScreenHandlerMixin {
|
||||
@Shadow
|
||||
@Final
|
||||
private ItemStack inputStack;
|
||||
|
||||
/**
|
||||
* Since stonecutting recipes with custom ingredients can be stack-aware, recalculating available recipes
|
||||
* only when the input stack's item changes is not enough. This mixin allows the available recipes to be
|
||||
* recalculated when the input stack changes in any way.
|
||||
*
|
||||
* @see <a href="https://github.com/FabricMC/fabric/issues/4340">Issue #4340</a>
|
||||
*/
|
||||
@Redirect(
|
||||
method = "onContentChanged",
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;isOf(Lnet/minecraft/item/Item;)Z")
|
||||
)
|
||||
private boolean recalculateAvailableRecipesForStackChange(ItemStack stack, Item item) {
|
||||
return ItemStack.areEqual(stack, this.inputStack);
|
||||
}
|
||||
}
|
|
@ -6,8 +6,7 @@
|
|||
"ingredient.ClientConnectionMixin",
|
||||
"ingredient.EncoderHandlerMixin",
|
||||
"ingredient.IngredientMixin",
|
||||
"ingredient.ShapelessRecipeMixin",
|
||||
"ingredient.StonecutterScreenHandlerMixin"
|
||||
"ingredient.ShapelessRecipeMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"type": "minecraft:stonecutting",
|
||||
"ingredient": "minecraft:redstone_ore",
|
||||
"result": {
|
||||
"id": "minecraft:redstone_block"
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
"type": "minecraft:stonecutting",
|
||||
"ingredient": {
|
||||
"fabric:type": "fabric:components",
|
||||
"base": "minecraft:redstone_ore",
|
||||
"components": {
|
||||
"minecraft:rarity": "epic"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"id": "minecraft:emerald_block"
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue