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

Commit

Permalink
Merge branch '1.17-2.0' into 1.18-2.0
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
#	gradle.properties
  • Loading branch information
Siphalor committed Jul 16, 2022
2 parents 0ec65b3 + 7eb5b41 commit 8f6495c
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ org.gradle.jvmargs=-Xmx1G
loader_version=0.12.5

# Mod Properties
mod_version = 2.1.4-alpha.1
mod_release = alpha
mod_version = 2.1.4-beta.2
mod_release = beta
mod_mc_version_specifier = 1.18.2
mod_mc_versions = 1.18.2
mod_id = nbtcrafting
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright 2020-2022 Siphalor
*
* 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 de.siphalor.nbtcrafting.mixin.cooking;

import net.minecraft.block.entity.AbstractFurnaceBlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.Recipe;
import net.minecraft.util.collection.DefaultedList;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

@Mixin(AbstractFurnaceBlockEntity.class)
public class MixinAbstractFurnaceBlockEntity {
@Inject(
method = "canAcceptRecipeOutput",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/item/ItemStack;getCount()I",
ordinal = 0
),
locals = LocalCapture.CAPTURE_FAILHARD,
cancellable = true
)
protected static void canAcceptRecipeOutputNBTCheck(@Nullable Recipe<?> recipe, DefaultedList<ItemStack> slots, int count, CallbackInfoReturnable<Boolean> cir, ItemStack recipeResult, ItemStack outputStack) {
if (!ItemStack.areNbtEqual(recipeResult, outputStack)) {
cir.setReturnValue(false);
}
}
}
1 change: 1 addition & 0 deletions src/main/resources/nbtcrafting.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"brewing.MixinBrewingSlotPotion",
"brewing.MixinBrewingStandBlockEntity",
"cauldron.MixinCauldronBlock",
"cooking.MixinAbstractFurnaceBlockEntity",
"cooking.MixinCookingRecipe",
"cooking.MixinCookingRecipeSerializer",
"crafting.MixinShapedRecipe",
Expand Down
16 changes: 16 additions & 0 deletions src/testmod/resources/data/minecraft/recipes/cooked_beef.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"type": "minecraft:smelting",
"ingredient": {
"item": "minecraft:beef",
"data": {
"deny": {
"CustomModelData": 1
}
}
},
"result": {
"item": "minecraft:cooked_beef"
},
"experience": 0.35,
"cookingtime": 200
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"type": "minecraft:smelting",
"cookingtime": 200,
"experience": 0.35,
"ingredient": {
"item": "minecraft:beef",
"data": {
"require": {
"CustomModelData": 1
}
}
},
"result": {
"item": "minecraft:cooked_beef",
"data": {
"CustomModelData": 1,
"display": {
"Name": "[{\"text\":\"Custom meat\",\"italic\":false}]"
}
}
}
}

0 comments on commit 8f6495c

Please sign in to comment.