diff --git a/src/main/java/forestry/core/proxy/ClientProxyCommon.java b/src/main/java/forestry/core/proxy/ClientProxyCommon.java index bab31f684..fe48e0ded 100755 --- a/src/main/java/forestry/core/proxy/ClientProxyCommon.java +++ b/src/main/java/forestry/core/proxy/ClientProxyCommon.java @@ -95,17 +95,6 @@ public class ClientProxyCommon extends ProxyCommon { return true; } - @Override - public EntityPlayer getPlayer(World world, GameProfile profile) { - EntityPlayer player = world.getPlayerEntityByName(profile.getName()); - if (player != null) - return player; - else if (world instanceof WorldServer) - return FakePlayerFactory.get((WorldServer) world, profile); - else - return null; - } - @Override public double getBlockReachDistance(EntityPlayer entityplayer) { if (entityplayer instanceof EntityPlayerSP) @@ -230,4 +219,9 @@ public class ClientProxyCommon extends ProxyCommon { public EntityPlayer getPlayer() { return Minecraft.getMinecraft().thePlayer; } + + @Override + public EntityPlayer getPlayer(World world, GameProfile profile) { + return super.getPlayer(world, profile); + } } diff --git a/src/main/java/forestry/core/proxy/ProxyCommon.java b/src/main/java/forestry/core/proxy/ProxyCommon.java index ef3a5bfc4..56af9b34d 100755 --- a/src/main/java/forestry/core/proxy/ProxyCommon.java +++ b/src/main/java/forestry/core/proxy/ProxyCommon.java @@ -165,19 +165,6 @@ public class ProxyCommon { return server.getConfigurationManager().func_152596_g(player.getGameProfile()); } - /** - * Get a player for a given World and GameProfile. - * If they are not in the World, returns a FakePlayer. - * Do not store references to the return value, to prevent worlds staying in memory. - */ - public EntityPlayer getPlayer(World world, GameProfile profile) { - EntityPlayer player = world.getPlayerEntityByName(profile.getName()); - if (player != null) - return player; - else - return FakePlayerFactory.get((WorldServer)world, profile); - } - public double getBlockReachDistance(EntityPlayer entityplayer) { return 4f; } @@ -313,4 +300,23 @@ public class ProxyCommon { public EntityPlayer getPlayer() { return null; } + + /** + * Get a player for a given World and GameProfile. + * If they are not in the World, returns a FakePlayer. + * Do not store references to the return value, to prevent worlds staying in memory. + */ + public EntityPlayer getPlayer(World world, GameProfile profile) { + if (world == null) + throw new IllegalArgumentException("World cannot be null"); + + if (profile == null || profile.getName() == null) + return FakePlayerFactory.getMinecraft((WorldServer)world); + + EntityPlayer player = world.getPlayerEntityByName(profile.getName()); + if (player != null) + return player; + else + return FakePlayerFactory.get((WorldServer)world, profile); + } }