Search in sources :

Example 56 with WorldServer

use of net.minecraft.server.v1_16_R2.WorldServer in project TheAPI by TheDevTec.

the class v1_10_R1 method packetRespawn.

@Override
public Object packetRespawn(Player player) {
    EntityPlayer entityPlayer = (EntityPlayer) getPlayer(player);
    WorldServer worldserver = entityPlayer.x();
    byte actualDimension = (byte) worldserver.getWorld().getEnvironment().getId();
    return new PacketPlayOutRespawn((byte) ((actualDimension >= 0) ? -1 : 0), worldserver.getDifficulty(), worldserver.getWorldData().getType(), entityPlayer.playerInteractManager.getGameMode());
}
Also used : EntityPlayer(net.minecraft.server.v1_10_R1.EntityPlayer) WorldServer(net.minecraft.server.v1_10_R1.WorldServer) PacketPlayOutRespawn(net.minecraft.server.v1_10_R1.PacketPlayOutRespawn)

Example 57 with WorldServer

use of net.minecraft.server.v1_16_R2.WorldServer in project TheAPI by TheDevTec.

the class v1_10_R1 method getChunk.

@Override
public Object getChunk(World world, int x, int z) {
    WorldServer sworld = ((CraftWorld) world).getHandle();
    net.minecraft.server.v1_10_R1.Chunk loaded = ((ChunkProviderServer) sworld.getChunkProvider()).getChunkIfLoaded(x, z);
    if (loaded == null) {
        // load
        try {
            net.minecraft.server.v1_10_R1.Chunk chunk;
            chunk = ((IChunkLoader) Ref.get(((ChunkProviderServer) sworld.getChunkProvider()), chunkLoader)).a(sworld, x, z);
            if (chunk != null) {
                chunk.setLastSaved(sworld.getTime());
                if (((ChunkProviderServer) sworld.getChunkProvider()).chunkGenerator != null) {
                    ((ChunkProviderServer) sworld.getChunkProvider()).chunkGenerator.recreateStructures(chunk, x, z);
                }
            }
            if (chunk != null) {
                ((ChunkProviderServer) sworld.getChunkProvider()).chunks.put(ChunkCoordIntPair.a(x, z), chunk);
                postToMainThread(() -> {
                    chunk.addEntities();
                });
                loaded = chunk;
            }
        } catch (Exception e) {
        }
    }
    if (loaded == null) {
        // generate new chunk
        ChunkRegionLoader loader = null;
        if ((IChunkLoader) Ref.get(((ChunkProviderServer) sworld.getChunkProvider()), chunkLoader) instanceof ChunkRegionLoader) {
            loader = (ChunkRegionLoader) Ref.get(((ChunkProviderServer) sworld.getChunkProvider()), chunkLoader);
        }
        if (loader != null && loader.chunkExists(sworld, x, z)) {
            loaded = ChunkIOExecutor.syncChunkLoad(sworld, loader, (ChunkProviderServer) sworld.getChunkProvider(), x, z);
        } else {
            loaded = ((ChunkProviderServer) sworld.getChunkProvider()).originalGetChunkAt(x, z);
        }
        loaded = ((ChunkProviderServer) sworld.getChunkProvider()).chunkGenerator.getOrCreateChunk(x, z);
        ((ChunkProviderServer) sworld.getChunkProvider()).chunks.put(ChunkCoordIntPair.a(x, z), loaded);
    }
    return loaded;
}
Also used : ChunkProviderServer(net.minecraft.server.v1_10_R1.ChunkProviderServer) WorldServer(net.minecraft.server.v1_10_R1.WorldServer) ChunkRegionLoader(net.minecraft.server.v1_10_R1.ChunkRegionLoader) CraftWorld(org.bukkit.craftbukkit.v1_10_R1.CraftWorld)

Example 58 with WorldServer

use of net.minecraft.server.v1_16_R2.WorldServer in project TheAPI by TheDevTec.

the class v1_13_R1 method packetRespawn.

@Override
public Object packetRespawn(Player player) {
    EntityPlayer entityPlayer = (EntityPlayer) getPlayer(player);
    WorldServer worldserver = entityPlayer.getWorldServer();
    byte actualDimension = (byte) worldserver.getWorld().getEnvironment().getId();
    return new PacketPlayOutRespawn((byte) ((actualDimension >= 0) ? -1 : 0), worldserver.getDifficulty(), worldserver.getWorldData().getType(), entityPlayer.playerInteractManager.getGameMode());
}
Also used : EntityPlayer(net.minecraft.server.v1_13_R1.EntityPlayer) WorldServer(net.minecraft.server.v1_13_R1.WorldServer) PacketPlayOutRespawn(net.minecraft.server.v1_13_R1.PacketPlayOutRespawn)

Example 59 with WorldServer

use of net.minecraft.server.v1_16_R2.WorldServer in project TheAPI by TheDevTec.

the class v1_11_R1 method getChunk.

@Override
public Object getChunk(World world, int x, int z) {
    WorldServer sworld = ((CraftWorld) world).getHandle();
    net.minecraft.server.v1_11_R1.Chunk loaded = ((ChunkProviderServer) sworld.getChunkProvider()).getChunkIfLoaded(x, z);
    if (loaded == null) {
        // load
        try {
            net.minecraft.server.v1_11_R1.Chunk chunk;
            chunk = ((IChunkLoader) Ref.get(((ChunkProviderServer) sworld.getChunkProvider()), chunkLoader)).a(sworld, x, z);
            if (chunk != null) {
                chunk.setLastSaved(sworld.getTime());
                if (((ChunkProviderServer) sworld.getChunkProvider()).chunkGenerator != null) {
                    ((ChunkProviderServer) sworld.getChunkProvider()).chunkGenerator.recreateStructures(chunk, x, z);
                }
            }
            if (chunk != null) {
                ((ChunkProviderServer) sworld.getChunkProvider()).chunks.put(ChunkCoordIntPair.a(x, z), chunk);
                postToMainThread(() -> {
                    chunk.addEntities();
                });
                loaded = chunk;
            }
        } catch (Exception e) {
        }
    }
    if (loaded == null) {
        // generate new chunk
        ChunkRegionLoader loader = null;
        if ((IChunkLoader) Ref.get(((ChunkProviderServer) sworld.getChunkProvider()), chunkLoader) instanceof ChunkRegionLoader) {
            loader = (ChunkRegionLoader) Ref.get(((ChunkProviderServer) sworld.getChunkProvider()), chunkLoader);
        }
        if (loader != null && loader.chunkExists(sworld, x, z)) {
            loaded = ChunkIOExecutor.syncChunkLoad(sworld, loader, (ChunkProviderServer) sworld.getChunkProvider(), x, z);
        } else {
            loaded = ((ChunkProviderServer) sworld.getChunkProvider()).originalGetChunkAt(x, z);
        }
        loaded = ((ChunkProviderServer) sworld.getChunkProvider()).chunkGenerator.getOrCreateChunk(x, z);
        ((ChunkProviderServer) sworld.getChunkProvider()).chunks.put(ChunkCoordIntPair.a(x, z), loaded);
    }
    return loaded;
}
Also used : ChunkProviderServer(net.minecraft.server.v1_11_R1.ChunkProviderServer) WorldServer(net.minecraft.server.v1_11_R1.WorldServer) ChunkRegionLoader(net.minecraft.server.v1_11_R1.ChunkRegionLoader) CraftWorld(org.bukkit.craftbukkit.v1_11_R1.CraftWorld)

Example 60 with WorldServer

use of net.minecraft.server.v1_16_R2.WorldServer in project TheAPI by TheDevTec.

the class v1_16_R2 method packetRespawn.

@Override
public Object packetRespawn(Player player) {
    EntityPlayer entityPlayer = (EntityPlayer) getPlayer(player);
    WorldServer worldserver = entityPlayer.getWorldServer();
    return new PacketPlayOutRespawn(worldserver.getDimensionManager(), worldserver.getDimensionKey(), BiomeManager.a(worldserver.getSeed()), entityPlayer.playerInteractManager.getGameMode(), entityPlayer.playerInteractManager.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true);
}
Also used : EntityPlayer(net.minecraft.server.v1_16_R2.EntityPlayer) WorldServer(net.minecraft.server.v1_16_R2.WorldServer) PacketPlayOutRespawn(net.minecraft.server.v1_16_R2.PacketPlayOutRespawn)

Aggregations

WorldServer (net.minecraft.server.v1_16_R3.WorldServer)24 WorldServer (net.minecraft.server.v1_12_R1.WorldServer)20 CraftWorld (org.bukkit.craftbukkit.v1_16_R3.CraftWorld)19 ArrayList (java.util.ArrayList)18 List (java.util.List)16 UUID (java.util.UUID)16 CraftWorld (org.bukkit.craftbukkit.v1_12_R1.CraftWorld)16 GameProfile (com.mojang.authlib.GameProfile)15 WorldServer (net.minecraft.server.v1_11_R1.WorldServer)15 Material (org.bukkit.Material)15 WorldServer (net.minecraft.server.v1_14_R1.WorldServer)14 WorldServer (net.minecraft.server.v1_15_R1.WorldServer)14 WorldServer (net.minecraft.server.v1_10_R1.WorldServer)13 Block (org.bukkit.block.Block)13 CraftWorld (org.bukkit.craftbukkit.v1_11_R1.CraftWorld)13 SkinnableEntity (net.citizensnpcs.npc.skin.SkinnableEntity)12 WorldServer (net.minecraft.server.v1_8_R3.WorldServer)12 LivingEntity (org.bukkit.entity.LivingEntity)12 CraftWorld (org.bukkit.craftbukkit.v1_10_R1.CraftWorld)11 WorldServer (net.minecraft.server.v1_13_R2.WorldServer)10