From ab1e5d2eba758556f969e88d5f5f6967ee18f5f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E9=9B=A8=E8=90=BD?= Date: Sun, 17 Nov 2024 09:34:27 +0800 Subject: [PATCH] Fix `Cannot copy null stack` issue. (Closes #1553) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 秋雨落 --- .../bukkit/inventory/CraftItemStackMixin.java | 9 +-------- .../common/mod/util/ArclightSpecialRecipe.java | 3 ++- .../world/level/block/FireBlockMixin_Fabric.java | 15 --------------- 3 files changed, 3 insertions(+), 24 deletions(-) diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/bukkit/inventory/CraftItemStackMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/bukkit/inventory/CraftItemStackMixin.java index 10ce54ffb..084f14a48 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/bukkit/inventory/CraftItemStackMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/bukkit/inventory/CraftItemStackMixin.java @@ -1,15 +1,8 @@ package io.izzel.arclight.common.mixin.bukkit.inventory; -import net.minecraft.world.item.ItemStack; import org.bukkit.craftbukkit.v.inventory.CraftItemStack; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; -@Mixin(CraftItemStack.class) +@Mixin(value = CraftItemStack.class, remap = false) public abstract class CraftItemStackMixin { - @Redirect(method = "asCraftMirror", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/ItemStack;isEmpty()Z")) - private static boolean arclight$asCraftMirror$ItemStack$isEmpty(ItemStack instance) { - return false; - } } diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mod/util/ArclightSpecialRecipe.java b/arclight-common/src/main/java/io/izzel/arclight/common/mod/util/ArclightSpecialRecipe.java index b25ae9790..54264f294 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mod/util/ArclightSpecialRecipe.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mod/util/ArclightSpecialRecipe.java @@ -5,6 +5,7 @@ import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeHolder; import net.minecraft.world.item.crafting.RecipeInput; +import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.craftbukkit.v.inventory.CraftComplexRecipe; import org.bukkit.craftbukkit.v.inventory.CraftItemStack; @@ -17,7 +18,7 @@ public class ArclightSpecialRecipe extends CraftComplexRecipe { private final Recipe recipe; public ArclightSpecialRecipe(NamespacedKey id, Recipe recipe) { - super(id, null, null); + super(id, new ItemStack(Material.AIR), null); this.recipe = recipe; } diff --git a/arclight-fabric/src/main/java/io/izzel/arclight/fabric/mixin/core/world/level/block/FireBlockMixin_Fabric.java b/arclight-fabric/src/main/java/io/izzel/arclight/fabric/mixin/core/world/level/block/FireBlockMixin_Fabric.java index 4bdb908b4..b1c08bc21 100644 --- a/arclight-fabric/src/main/java/io/izzel/arclight/fabric/mixin/core/world/level/block/FireBlockMixin_Fabric.java +++ b/arclight-fabric/src/main/java/io/izzel/arclight/fabric/mixin/core/world/level/block/FireBlockMixin_Fabric.java @@ -5,19 +5,4 @@ @Mixin(FireBlock.class) public abstract class FireBlockMixin_Fabric { - - // @Inject(method = "checkBurnOut", cancellable = true, at = @At(value = "INVOKE", ordinal = 1, target = "Lnet/minecraft/world/level/Level;getBlockState(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/level/block/state/BlockState;")) - // private void arclight$blockBurn(Level worldIn, BlockPos pos, int i, RandomSource randomSource, int j, CallbackInfo ci) { - // Block theBlock = CraftBlock.at(worldIn, pos); - // Block sourceBlock = CraftBlock.at(worldIn, pos.relative(face)); - // BlockBurnEvent event = new BlockBurnEvent(theBlock, sourceBlock); - // Bukkit.getPluginManager().callEvent(event); - // if (event.isCancelled()) { - // ci.cancel(); - // return; - // } - // if (worldIn.getBlockState(pos).getBlock() instanceof TntBlock && !CraftEventFactory.callTNTPrimeEvent(worldIn, pos, TNTPrimeEvent.PrimeCause.FIRE, null, pos.relative(face))) { - // ci.cancel(); - // } - // } }