Skip to content

Commit 1da84b7

Browse files
committed
可能修复了bug
1 parent 67776fc commit 1da84b7

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

src/main/java/com/circulation/random_complement/mixin/nee/new_patten_gui/MixinPacketRecipeTransfer.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import appeng.api.networking.IGridNode;
44
import appeng.container.implementations.ContainerPatternTerm;
5+
import appeng.helpers.ItemStackHelper;
56
import appeng.util.helpers.ItemHandlerUtil;
67
import appeng.util.inv.WrapperInvItemHandler;
78
import com.github.vfyjxf.nee.network.packet.PacketRecipeTransfer;
@@ -40,15 +41,15 @@ public IMessage onMessage(PacketRecipeTransfer message, MessageContext ctx) {
4041

4142
for (int i = 0; i < recipeInputs.length; ++i) {
4243
NBTTagCompound currentStack = message.getInput().getCompoundTag("#" + i);
43-
recipeInputs[i] = currentStack.isEmpty() ? ItemStack.EMPTY : new ItemStack(currentStack);
44+
recipeInputs[i] = currentStack.isEmpty() ? ItemStack.EMPTY : ItemStackHelper.stackFromNBT(currentStack);
4445
}
4546

4647
if (!message.getOutput().isEmpty()) {
4748
recipeOutputs = new ItemStack[cct.getInventoryByName("output").getSlots()];
4849

4950
for (int i = 0; i < recipeOutputs.length; ++i) {
5051
NBTTagCompound currentStack = message.getOutput().getCompoundTag("O" + i);
51-
recipeOutputs[i] = currentStack.isEmpty() ? ItemStack.EMPTY : new ItemStack(currentStack);
52+
recipeOutputs[i] = currentStack.isEmpty() ? ItemStack.EMPTY : ItemStackHelper.stackFromNBT(currentStack);
5253
}
5354
}
5455

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.circulation.random_complement.mixin.nee.new_patten_gui;
2+
3+
import appeng.helpers.ItemStackHelper;
4+
import com.github.vfyjxf.nee.jei.PatternTransferHandler;
5+
import net.minecraft.item.ItemStack;
6+
import net.minecraft.nbt.NBTTagCompound;
7+
import org.spongepowered.asm.mixin.Mixin;
8+
import org.spongepowered.asm.mixin.injection.At;
9+
import org.spongepowered.asm.mixin.injection.Redirect;
10+
11+
@Mixin(value = PatternTransferHandler.class, remap = false)
12+
public class MixinPatternTransferHandler {
13+
14+
@Redirect(method = "packRecipe", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;writeToNBT(Lnet/minecraft/nbt/NBTTagCompound;)Lnet/minecraft/nbt/NBTTagCompound;", remap = true))
15+
public NBTTagCompound writeBigSizeItemNBT(ItemStack instance, NBTTagCompound nbtTagCompound) {
16+
ItemStackHelper.stackWriteToNBT(instance, nbtTagCompound);
17+
return nbtTagCompound;
18+
}
19+
}

src/main/resources/mixins.random_complement.nee.new_patten_gui.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"minVersion": "0.8.5",
66
"compatibilityLevel": "JAVA_8",
77
"mixins": [
8-
"MixinPacketRecipeTransfer"
8+
"MixinPacketRecipeTransfer",
9+
"MixinPatternTransferHandler"
910
]
1011
}

0 commit comments

Comments
 (0)