public boolean entityJoinedWorld(Entity var1) {
        int var2 = MathHelper.floor_double(var1.posX / 16.0D);
        int var3 = MathHelper.floor_double(var1.posZ / 16.0D);
        boolean var4 = false;
        if (var1 instanceof EntityPlayer) {
            var4 = true;
        }

        if (!var4 && !this.chunkExists(var2, var3)) {
            return false;
        } else {
            if (var1 instanceof EntityPlayer) {
                EntityPlayer var5 = (EntityPlayer) var1;
                this.playerEntities.add(var5);
                this.updateAllPlayersSleepingFlag();
            }

            this.getChunkFromChunkCoords(var2, var3).addEntity(var1);
            this.loadedEntityList.add(var1);
            this.obtainEntitySkin(var1);
            return true;
        }
    }