fix client -> server sync in creative gui (#913)

This commit is contained in:
lc-1337 authored and GitHub committed 2026-04-12 14:47:27 +03:00
1 parent b30ca57e68
commit 96ccd4e109
2 files changed
+26 -5

No files matched your search

@@ -32,6 +32,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.gui.inventory.GuiContainerCreative;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.player.EntityPlayer;
@@ -272,8 +273,18 @@ public class NEIClientUtils extends NEIServerUtils {
given += qty;
if (given >= stack.stackSize) break;
}
if (given > 0) NEICPH.sendGiveItem(copyStack(typestack, given), false, false);
} else NEICPH.sendGiveItem(stack, infinite, true);
if (given > 0) {
if (mc().currentScreen instanceof GuiContainerCreative gcc) {
mc().thePlayer.inventory.addItemStackToInventory(stack);
gcc.inventorySlots.detectAndSendChanges();
} else NEICPH.sendGiveItem(copyStack(typestack, given), false, false);
}
} else {
if (mc().currentScreen instanceof GuiContainerCreative gcc) {
mc().thePlayer.inventory.addItemStackToInventory(stack);
gcc.inventorySlots.detectAndSendChanges();
} else NEICPH.sendGiveItem(stack, infinite, true);
}
} else {
for (int given = 0; given < stack.stackSize;) {
int qty = Math.min(stack.stackSize - given, stack.getMaxStackSize());