FMLNetworkHandler.openGui should not try and open a GUI on a FakePlayer.
Fixes #2082 and probably dozens of mod errors. Also, side benefit of the merged codebase! FML code can ref Forge code!
This commit is contained in:
parent
4315637f75
commit
5074f26ccd
1 changed files with 6 additions and 1 deletions
|
@ -29,6 +29,7 @@ import net.minecraft.network.NetworkManager;
|
||||||
import net.minecraft.network.Packet;
|
import net.minecraft.network.Packet;
|
||||||
import net.minecraft.server.management.ServerConfigurationManager;
|
import net.minecraft.server.management.ServerConfigurationManager;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.util.FakePlayer;
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||||
import net.minecraftforge.fml.common.FMLContainer;
|
import net.minecraftforge.fml.common.FMLContainer;
|
||||||
import net.minecraftforge.fml.common.FMLLog;
|
import net.minecraftforge.fml.common.FMLLog;
|
||||||
|
@ -73,7 +74,7 @@ public class FMLNetworkHandler
|
||||||
public static void openGui(EntityPlayer entityPlayer, Object mod, int modGuiId, World world, int x, int y, int z)
|
public static void openGui(EntityPlayer entityPlayer, Object mod, int modGuiId, World world, int x, int y, int z)
|
||||||
{
|
{
|
||||||
ModContainer mc = FMLCommonHandler.instance().findContainerFor(mod);
|
ModContainer mc = FMLCommonHandler.instance().findContainerFor(mod);
|
||||||
if (entityPlayer instanceof EntityPlayerMP)
|
if (entityPlayer instanceof EntityPlayerMP && !(entityPlayer instanceof FakePlayer))
|
||||||
{
|
{
|
||||||
EntityPlayerMP entityPlayerMP = (EntityPlayerMP) entityPlayer;
|
EntityPlayerMP entityPlayerMP = (EntityPlayerMP) entityPlayer;
|
||||||
Container remoteGuiContainer = NetworkRegistry.INSTANCE.getRemoteGuiContainer(mc, entityPlayerMP, modGuiId, world, x, y, z);
|
Container remoteGuiContainer = NetworkRegistry.INSTANCE.getRemoteGuiContainer(mc, entityPlayerMP, modGuiId, world, x, y, z);
|
||||||
|
@ -92,6 +93,10 @@ public class FMLNetworkHandler
|
||||||
entityPlayerMP.openContainer.addCraftingToCrafters(entityPlayerMP);
|
entityPlayerMP.openContainer.addCraftingToCrafters(entityPlayerMP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (entityPlayer instanceof FakePlayer)
|
||||||
|
{
|
||||||
|
// NO OP - I won't even log a message!
|
||||||
|
}
|
||||||
else if (FMLCommonHandler.instance().getSide().equals(Side.CLIENT))
|
else if (FMLCommonHandler.instance().getSide().equals(Side.CLIENT))
|
||||||
{
|
{
|
||||||
Object guiContainer = NetworkRegistry.INSTANCE.getLocalGuiContainer(mc, entityPlayer, modGuiId, world, x, y, z);
|
Object guiContainer = NetworkRegistry.INSTANCE.getLocalGuiContainer(mc, entityPlayer, modGuiId, world, x, y, z);
|
||||||
|
|
Loading…
Reference in a new issue