Fix a server crash relating to a client-side only class initialization (credit to @kosakriszi). Closes #1442.

This commit is contained in:
Ben Spiers 2014-06-27 03:25:47 +01:00
parent ff1b3b792e
commit 4d0f276e55
3 changed files with 15 additions and 7 deletions

View file

@ -144,6 +144,7 @@ import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -554,4 +555,10 @@ public class ClientProxy extends CommonProxy
MekanismClient.voiceClient.start();
}
}
@Override
public EntityPlayer getPlayer(MessageContext context)
{
return Minecraft.getMinecraft().thePlayer;
}
}

View file

@ -84,6 +84,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.config.Configuration;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.FMLInjectionData;
@ -459,4 +460,10 @@ public class CommonProxy
Mekanism.logger.info("Received config from server.");
}
public EntityPlayer getPlayer(MessageContext context)
{
return context.getServerHandler().playerEntity;
}
}

View file

@ -189,13 +189,7 @@ public class PacketHandler
public static EntityPlayer getPlayer(MessageContext context)
{
if(context.side.isClient())
{
return Minecraft.getMinecraft().thePlayer;
}
else {
return context.getServerHandler().playerEntity;
}
return Mekanism.proxy.getPlayer(context);
}
/**