Compare commits

...
Author SHA1 Message Date
miozune 336c7dc621 Fix inventory desync when closing GuiRecipe (#320) 2022-11-29 18:21:45 +01:00
Yang Xizhi 2130a47f6f fix overlap of ? button (#321) 2022-11-29 11:19:42 +01:00
4 changed files with 25 additions and 7 deletions

No files matched your search

@@ -141,6 +141,13 @@ public class NEICPH implements IClientPacketHandler {
packet.sendToServer();
}
public static void sendRequestContainer() {
PacketCustom packet = new PacketCustom(channel, 16);
packet.writeInt(
Minecraft.getMinecraft().thePlayer.openContainer.getInventory().size());
packet.sendToServer();
}
public static void sendSetSlot(int slot, ItemStack stack, boolean container) {
PacketCustom packet = new PacketCustom(channel, 5);
packet.writeBoolean(container);
@@ -64,6 +64,9 @@ public class NEISPH implements IServerPacketHandler {
case 15:
handleMobSpawnerID(sender.worldObj, packet.readCoord(), packet.readString());
break;
case 16:
handleRequestContainer(sender, packet.readInt());
break;
case 21:
openEnchantmentGui(sender);
break;
@@ -99,6 +102,11 @@ public class NEISPH implements IServerPacketHandler {
}
}
private void handleRequestContainer(EntityPlayerMP sender, int containerSize) {
if (sender.openContainer.getInventory().size() != containerSize) return;
sender.sendContainerToPlayer(sender.openContainer);
}
private void handlePropertyChange(EntityPlayerMP sender, PacketCustom packet) {
String name = packet.readString();
if (NEIServerConfig.canPlayerPerformAction(sender.getCommandSenderName(), name))
@@ -3,6 +3,7 @@ package codechicken.nei.recipe;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.GuiNEIButton;
import codechicken.nei.LayoutManager;
import codechicken.nei.NEICPH;
import codechicken.nei.NEIClientConfig;
import codechicken.nei.NEIClientUtils;
import codechicken.nei.PositionedStack;
@@ -336,6 +337,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer
if (i == Keyboard.KEY_ESCAPE) // esc
{
mc.displayGuiScreen(firstGuiGeneral);
NEICPH.sendRequestContainer();
return;
}
if (GuiContainerManager.getManager(this).lastKeyTyped(i, c)) return;
@@ -346,6 +348,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer
if (i == mc.gameSettings.keyBindInventory.getKeyCode()) {
mc.displayGuiScreen(firstGuiGeneral);
NEICPH.sendRequestContainer();
} else if (NEIClientConfig.isKeyHashDown("gui.back")) {
mc.displayGuiScreen(prevGui);
} else if (NEIClientConfig.isKeyHashDown("gui.prev_machine")) {
@@ -48,14 +48,14 @@ com.rwtema.extrautils.nei.InfoHandler,Extra Utilities,ExtraUtilities:chandelier,
com.rwtema.extrautils.nei.MicroBlocksHandler,Extra Utilities,ExtraUtilities:microblocks:1,,ExtraUtilities,TRUE,,,,,,,,,,,
com.rwtema.extrautils.nei.SoulHandler,Extra Utilities,ExtraUtilities:mini-soul,,ExtraUtilities,TRUE,,,,,,,,,,,
hellfirepvp.beebetteratbees.client.gui.BBABGuiRecipeTreeHandler,Bees,Forestry:beeQueenGE,,Forestry,TRUE,,,140,,2,,,,,,
forestry.factory.recipes.nei.NEIHandlerBottler,Forestry for Minecraft,Forestry:factory,,Forestry,TRUE,,,68,,5,,,,,,
forestry.factory.recipes.nei.NEIHandlerCarpenter,Forestry for Minecraft,Forestry:factory:1,,Forestry,TRUE,,,65,,5,,,,,,
forestry.factory.recipes.nei.NEIHandlerCentrifuge,Forestry for Minecraft,Forestry:factory:2,,Forestry,TRUE,,,65,,5,,,,,,
forestry.factory.recipes.nei.NEIHandlerBottler,Forestry for Minecraft,Forestry:factory,,Forestry,TRUE,,,84,,5,,,,,,
forestry.factory.recipes.nei.NEIHandlerCarpenter,Forestry for Minecraft,Forestry:factory:1,,Forestry,TRUE,,,81,,5,,,,,,
forestry.factory.recipes.nei.NEIHandlerCentrifuge,Forestry for Minecraft,Forestry:factory:2,,Forestry,TRUE,,,81,,5,,,,,,
forestry.factory.recipes.nei.NEIHandlerFabricator,Forestry for Minecraft,Forestry:factory2,,Forestry,TRUE,,,,,,,,,,,
forestry.factory.recipes.nei.NEIHandlerFermenter,Forestry for Minecraft,Forestry:factory:3,,Forestry,TRUE,,,65,,5,,,,,,
forestry.factory.recipes.nei.NEIHandlerMoistener,Forestry for Minecraft,Forestry:factory:4,,Forestry,TRUE,,,68,,5,,,,,,
forestry.factory.recipes.nei.NEIHandlerSqueezer,Forestry for Minecraft,Forestry:factory:5,,Forestry,TRUE,,,68,,5,,,,,,
forestry.factory.recipes.nei.NEIHandlerStill,Forestry for Minecraft,Forestry:factory:6,,Forestry,TRUE,,,65,,5,,,,,,
forestry.factory.recipes.nei.NEIHandlerFermenter,Forestry for Minecraft,Forestry:factory:3,,Forestry,TRUE,,,81,,5,,,,,,
forestry.factory.recipes.nei.NEIHandlerMoistener,Forestry for Minecraft,Forestry:factory:4,,Forestry,TRUE,,,84,,5,,,,,,
forestry.factory.recipes.nei.NEIHandlerSqueezer,Forestry for Minecraft,Forestry:factory:5,,Forestry,TRUE,,,84,,5,,,,,,
forestry.factory.recipes.nei.NEIHandlerStill,Forestry for Minecraft,Forestry:factory:6,,Forestry,TRUE,,,81,,5,,,,,,
net.bdew.neiaddons.forestry.bees.BeeBreedingHandler,Forestry for Minecraft,Forestry:beeQueenGE,,Forestry,TRUE,,,65,,5,,,,,,
net.bdew.neiaddons.forestry.bees.BeeProduceHandler,Forestry for Minecraft,Forestry:beeQueenGE,,Forestry,TRUE,,,65,,5,,,,,,
net.bdew.neiaddons.forestry.butterflies.ButterflyBreedingHandler,Forestry for Minecraft,Forestry:butterflyGE,,Forestry,TRUE,,,,,,,,,,,
1 handler modName itemName nbtInfo modId modRequired excludedModId yShift handlerHeight handlerWidth maxRecipesPerPage imageResource imageX imageY imageWidth imageHeight itemNotes
48 com.rwtema.extrautils.nei.MicroBlocksHandler Extra Utilities ExtraUtilities:microblocks:1 ExtraUtilities TRUE
49 com.rwtema.extrautils.nei.SoulHandler Extra Utilities ExtraUtilities:mini-soul ExtraUtilities TRUE
50 hellfirepvp.beebetteratbees.client.gui.BBABGuiRecipeTreeHandler Bees Forestry:beeQueenGE Forestry TRUE 140 2
51 forestry.factory.recipes.nei.NEIHandlerBottler Forestry for Minecraft Forestry:factory Forestry TRUE 68 84 5
52 forestry.factory.recipes.nei.NEIHandlerCarpenter Forestry for Minecraft Forestry:factory:1 Forestry TRUE 65 81 5
53 forestry.factory.recipes.nei.NEIHandlerCentrifuge Forestry for Minecraft Forestry:factory:2 Forestry TRUE 65 81 5
54 forestry.factory.recipes.nei.NEIHandlerFabricator Forestry for Minecraft Forestry:factory2 Forestry TRUE
55 forestry.factory.recipes.nei.NEIHandlerFermenter Forestry for Minecraft Forestry:factory:3 Forestry TRUE 65 81 5
56 forestry.factory.recipes.nei.NEIHandlerMoistener Forestry for Minecraft Forestry:factory:4 Forestry TRUE 68 84 5
57 forestry.factory.recipes.nei.NEIHandlerSqueezer Forestry for Minecraft Forestry:factory:5 Forestry TRUE 68 84 5
58 forestry.factory.recipes.nei.NEIHandlerStill Forestry for Minecraft Forestry:factory:6 Forestry TRUE 65 81 5
59 net.bdew.neiaddons.forestry.bees.BeeBreedingHandler Forestry for Minecraft Forestry:beeQueenGE Forestry TRUE 65 5
60 net.bdew.neiaddons.forestry.bees.BeeProduceHandler Forestry for Minecraft Forestry:beeQueenGE Forestry TRUE 65 5
61 net.bdew.neiaddons.forestry.butterflies.ButterflyBreedingHandler Forestry for Minecraft Forestry:butterflyGE Forestry TRUE