Skip to content

Commit

Permalink
Merge pull request #17 from GTNewHorizons/packet
Browse files Browse the repository at this point in the history
asm packet return to crafting inventory
  • Loading branch information
Dream-Master authored Sep 21, 2022
2 parents a63add7 + de89fae commit 6941871
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ public static IAEItemStack wrapFluidPacketStack(IAEItemStack stack) {
return stack;
}

public static ItemStack removeFluidPackets(InventoryCrafting inv, int index) {
ItemStack stack = inv.getStackInSlot(index);
if (stack != null && stack.getItem() instanceof ItemFluidPacket) {
FluidStack fluid = ItemFluidPacket.getFluidStack(stack);
return ItemFluidDrop.newStack(fluid);
}
else {
return stack;
}
}

@Nullable
public static InventoryAdaptor wrapInventory(@Nullable TileEntity tile, ForgeDirection face) {
return tile != null ? FluidConvertingInventoryAdaptor.wrap(tile, Util.from(face)) : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ public void visitMethodInsn(int opcode, String owner, String name, String desc,
return;
}
}
if (opcode == Opcodes.INVOKEVIRTUAL
&& owner.equals("net/minecraft/inventory/InventoryCrafting") && name.equals("getStackInSlot")) {
super.visitMethodInsn(Opcodes.INVOKESTATIC,
"com/glodblock/github/coremod/hooker/CoreModHooks",
"removeFluidPackets",
"(Lnet/minecraft/inventory/InventoryCrafting;I)Lnet/minecraft/item/ItemStack;",
false);
return;
}
super.visitMethodInsn(opcode, owner, name, desc, itf);
if (gotInventory) {
if (opcode == Opcodes.INVOKESTATIC
Expand Down

0 comments on commit 6941871

Please sign in to comment.