MC百科社群

标题: 有谁帮忙看看问题出在哪吗?(Fabric 1.19.3) [打印本页]

作者: InkSoul    时间: 2023-1-16 10:49
标题: 有谁帮忙看看问题出在哪吗?(Fabric 1.19.3)
本帖最后由 InkSoul 于 2023-1-16 10:53 编辑

有谁帮忙看看问题出在哪吗?(Fabric 1.19.3)
  1. @Redirect(at = @At(value="INVOKE",target = "Lnet/minecraft/inventory/Inventory;removeStack(II)Lnet/minecraft/item/ItemStack;"),method = "onTakeItem")
  2.     public ItemStack removeStackProxy(CraftingInventory input, int slot, int amount){
  3.         if(input.getStack(slot).getItem() instanceof CraftingToolIm o){
  4.             var save = input.getStack(slot).copy();
  5.             save.damage(o.getDamageStep(), Random.create(), null);
  6.             input.setStack(slot, save);
  7.         }else{
  8.             //input.removeStack(slot, amount);
  9.         }
  10.         return new ItemStack(Items.AIR);
  11.     }
  12.     /*每次都因为 Caused by: org.spongepowered.asm.mixin.injection.throwables.InjectionError: Critical injection failure:Redirector removeStackProxy(Lnet/minecraft/inventory/CraftingInventory;II)Lnet/minecraft/item/ItemStack; in crafttech.mixins.json:CraftingMixin from mod crafttech failed injection check, (0/1) succeeded. Scanned 1 target(s). No refMap loaded. 崩溃*/
复制代码
(真的不太懂Mixin,1.19.3没法直接Overwrite)








欢迎光临 MC百科社群 (https://bbs.mcmod.cn/) MC百科|最大的MineCraft中文模组百科