Skip to content

Commit 9eafc58

Browse files
committed
fix phantom slot filter not working
1 parent 2db8384 commit 9eafc58

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/com/cleanroommc/modularui/value/sync/ItemSlotSH.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import net.minecraft.item.ItemStack;
88
import net.minecraft.network.PacketBuffer;
9+
import net.minecraftforge.fml.relauncher.Side;
910
import net.minecraftforge.items.ItemHandlerHelper;
1011

1112
import org.jetbrains.annotations.ApiStatus;
@@ -87,7 +88,7 @@ public void readOnServer(int id, PacketBuffer buf) throws IOException {
8788
setEnabled(buf.readBoolean(), false);
8889
} else if (id == 5) {
8990
if (!isPhantom()) return;
90-
phantomClick(MouseData.create(0), buf.readItemStack());
91+
phantomClick(new MouseData(Side.SERVER, 0, false, false, false), buf.readItemStack());
9192
}
9293
}
9394

@@ -99,6 +100,7 @@ protected void phantomClick(MouseData mouseData, ItemStack cursorStack) {
99100
ItemStack slotStack = getSlot().getStack();
100101
ItemStack stackToPut;
101102
if (!cursorStack.isEmpty() && !slotStack.isEmpty() && !ItemHandlerHelper.canItemStacksStack(cursorStack, slotStack)) {
103+
if (!isItemValid(cursorStack)) return;
102104
stackToPut = cursorStack.copy();
103105
if (mouseData.mouseButton == 1) {
104106
stackToPut.setCount(1);
@@ -114,6 +116,7 @@ protected void phantomClick(MouseData mouseData, ItemStack cursorStack) {
114116
return;
115117
}
116118
} else {
119+
if (!isItemValid(cursorStack)) return;
117120
stackToPut = cursorStack.copy();
118121
}
119122
if (mouseData.mouseButton == 1) {

0 commit comments

Comments
 (0)