本帖最后由 InkSoul 于 2023-1-16 10:53 编辑
有谁帮忙看看问题出在哪吗?(Fabric 1.19.3)
- @Redirect(at = @At(value="INVOKE",target = "Lnet/minecraft/inventory/Inventory;removeStack(II)Lnet/minecraft/item/ItemStack;"),method = "onTakeItem")
- public ItemStack removeStackProxy(CraftingInventory input, int slot, int amount){
- if(input.getStack(slot).getItem() instanceof CraftingToolIm o){
- var save = input.getStack(slot).copy();
- save.damage(o.getDamageStep(), Random.create(), null);
- input.setStack(slot, save);
- }else{
- //input.removeStack(slot, amount);
- }
- return new ItemStack(Items.AIR);
- }
- /*每次都因为 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)
|
|