diff --git a/src/codechicken/nei/LayoutManager.java b/src/codechicken/nei/LayoutManager.java index 346332ec..ed86fb2e 100644 --- a/src/codechicken/nei/LayoutManager.java +++ b/src/codechicken/nei/LayoutManager.java @@ -573,9 +573,8 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH NEIController.load(gui); - if (checkCreativeInv(gui) && - gui.mc.currentScreen instanceof GuiContainerCreative)//makes cycle transitions seamless. Only closes if we are opening from fresh - gui.mc.displayGuiScreen(null); + if (checkCreativeInv(gui) && gui.mc.currentScreen instanceof GuiContainerCreative)//override creative with creative+ + gui.mc.displayGuiScreen(null);//close the screen and wait for the server to open it for us } @Override diff --git a/src/codechicken/nei/NEISPH.java b/src/codechicken/nei/NEISPH.java index bacf3da0..4bc606c4 100644 --- a/src/codechicken/nei/NEISPH.java +++ b/src/codechicken/nei/NEISPH.java @@ -119,7 +119,7 @@ public class NEISPH implements IServerPacketHandler NEIServerConfig.disableAction(sender.dimension, name, packet.readBoolean()); } - private void processCreativeInv(EntityPlayerMP sender, boolean open) { + public static void processCreativeInv(EntityPlayerMP sender, boolean open) { if (open) { ServerUtils.openSMPContainer(sender, new ContainerCreativeInv(sender, new ExtendedCreativeInv(NEIServerConfig.forPlayer(sender.getCommandSenderName()), Side.SERVER)), new IGuiPacketSender() { diff --git a/src/codechicken/nei/NEIServerUtils.java b/src/codechicken/nei/NEIServerUtils.java index 5a8dfe84..5818b09a 100644 --- a/src/codechicken/nei/NEIServerUtils.java +++ b/src/codechicken/nei/NEIServerUtils.java @@ -239,9 +239,13 @@ public class NEIServerUtils !NEIServerConfig.canPlayerPerformAction(player.getCommandSenderName(), NEIActions.gameModes[mode])) return; + //creative+ + NEIServerConfig.forPlayer(player.getCommandSenderName()).enableAction("creative+", mode == 2); + if(mode == 2 && !(player.openContainer instanceof ContainerCreativeInv))//open the container immediately for the client + NEISPH.processCreativeInv(player, true); + //change it on the server player.theItemInWorldManager.setGameType(getGameType(mode)); - NEIServerConfig.forPlayer(player.getCommandSenderName()).enableAction("creative+", mode == 2); //tell the client to change it new PacketCustom(NEISPH.channel, 14).writeByte(mode).sendToPlayer(player);