Skip to content

Commit

Permalink
fix phantom slot filter not working
Browse files Browse the repository at this point in the history
  • Loading branch information
brachy84 committed Jan 27, 2025
1 parent 2db8384 commit 9eafc58
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.items.ItemHandlerHelper;

import org.jetbrains.annotations.ApiStatus;
Expand Down Expand Up @@ -87,7 +88,7 @@ public void readOnServer(int id, PacketBuffer buf) throws IOException {
setEnabled(buf.readBoolean(), false);
} else if (id == 5) {
if (!isPhantom()) return;
phantomClick(MouseData.create(0), buf.readItemStack());
phantomClick(new MouseData(Side.SERVER, 0, false, false, false), buf.readItemStack());
}
}

Expand All @@ -99,6 +100,7 @@ protected void phantomClick(MouseData mouseData, ItemStack cursorStack) {
ItemStack slotStack = getSlot().getStack();
ItemStack stackToPut;
if (!cursorStack.isEmpty() && !slotStack.isEmpty() && !ItemHandlerHelper.canItemStacksStack(cursorStack, slotStack)) {
if (!isItemValid(cursorStack)) return;
stackToPut = cursorStack.copy();
if (mouseData.mouseButton == 1) {
stackToPut.setCount(1);
Expand All @@ -114,6 +116,7 @@ protected void phantomClick(MouseData mouseData, ItemStack cursorStack) {
return;
}
} else {
if (!isItemValid(cursorStack)) return;
stackToPut = cursorStack.copy();
}
if (mouseData.mouseButton == 1) {
Expand Down

0 comments on commit 9eafc58

Please sign in to comment.