Search in sources :

Example 16 with Chunk

use of net.minecraft.server.v1_16_R3.Chunk in project Movecraft by APDevTeam.

the class IWorldHandler method moveTileEntity.

private void moveTileEntity(@NotNull World nativeWorld, @NotNull BlockPosition newPosition, @NotNull TileEntity tile) {
    Chunk chunk = nativeWorld.getChunkAtWorldCoords(newPosition);
    tile.invalidateBlockCache();
    tile.setLocation(nativeWorld, newPosition);
    if (nativeWorld.captureBlockStates) {
        tile.setLocation(nativeWorld, newPosition);
        nativeWorld.capturedTileEntities.put(newPosition, tile);
        return;
    }
    chunk.tileEntities.put(newPosition, tile);
}
Also used : Chunk(net.minecraft.server.v1_16_R3.Chunk)

Example 17 with Chunk

use of net.minecraft.server.v1_16_R3.Chunk in project RoseStacker by Rosewood-Development.

the class NMSHandlerImpl method spawnExistingEntity.

@Override
public void spawnExistingEntity(LivingEntity entity, SpawnReason spawnReason, boolean bypassSpawnEvent) {
    Location location = entity.getLocation();
    World world = location.getWorld();
    if (world == null)
        throw new IllegalArgumentException("Entity is not in a loaded world");
    if (bypassSpawnEvent) {
        IChunkAccess ichunkaccess = ((CraftWorld) world).getHandle().getChunkAt(MathHelper.floor(entity.getLocation().getX() / 16.0D), MathHelper.floor(entity.getLocation().getZ() / 16.0D), ChunkStatus.FULL, false);
        if (!(ichunkaccess instanceof Chunk))
            return;
        ichunkaccess.a(((CraftEntity) entity).getHandle());
        ((CraftWorld) world).getHandle().addEntityChunk(((CraftEntity) entity).getHandle());
    } else {
        ((CraftWorld) world).addEntity(((CraftEntity) entity).getHandle(), spawnReason);
    }
}
Also used : IChunkAccess(net.minecraft.server.v1_16_R3.IChunkAccess) World(org.bukkit.World) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld) Chunk(net.minecraft.server.v1_16_R3.Chunk) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld) Location(org.bukkit.Location)

Example 18 with Chunk

use of net.minecraft.server.v1_16_R3.Chunk in project dynmap by webbukkit.

the class MapChunkCache116_3 method getLoadedChunk.

// Load generic chunk from existing and already loaded chunk
protected GenericChunk getLoadedChunk(DynmapChunk chunk) {
    CraftWorld cw = (CraftWorld) w;
    NBTTagCompound nbt = null;
    GenericChunk gc = null;
    if (cw.isChunkLoaded(chunk.x, chunk.z)) {
        Chunk c = cw.getHandle().getChunkAt(chunk.x, chunk.z);
        if ((c != null) && c.loaded) {
            nbt = ChunkRegionLoader.saveChunk(cw.getHandle(), c);
        }
        if (nbt != null) {
            gc = parseChunkFromNBT(new NBT.NBTCompound(nbt));
        }
    }
    return gc;
}
Also used : GenericChunk(org.dynmap.common.chunk.GenericChunk) NBTTagCompound(net.minecraft.server.v1_16_R2.NBTTagCompound) GenericChunk(org.dynmap.common.chunk.GenericChunk) DynmapChunk(org.dynmap.DynmapChunk) Chunk(net.minecraft.server.v1_16_R2.Chunk) CraftWorld(org.bukkit.craftbukkit.v1_16_R2.CraftWorld)

Example 19 with Chunk

use of net.minecraft.server.v1_16_R3.Chunk in project dynmap by webbukkit.

the class MapChunkCache116 method getLoadedChunk.

// Load generic chunk from existing and already loaded chunk
protected GenericChunk getLoadedChunk(DynmapChunk chunk) {
    CraftWorld cw = (CraftWorld) w;
    NBTTagCompound nbt = null;
    GenericChunk gc = null;
    if (cw.isChunkLoaded(chunk.x, chunk.z)) {
        Chunk c = cw.getHandle().getChunkAt(chunk.x, chunk.z);
        if ((c != null) && c.loaded) {
            nbt = ChunkRegionLoader.saveChunk(cw.getHandle(), c);
        }
        if (nbt != null) {
            gc = parseChunkFromNBT(new NBT.NBTCompound(nbt));
        }
    }
    return gc;
}
Also used : GenericChunk(org.dynmap.common.chunk.GenericChunk) NBTTagCompound(net.minecraft.server.v1_16_R1.NBTTagCompound) GenericChunk(org.dynmap.common.chunk.GenericChunk) Chunk(net.minecraft.server.v1_16_R1.Chunk) DynmapChunk(org.dynmap.DynmapChunk) CraftWorld(org.bukkit.craftbukkit.v1_16_R1.CraftWorld)

Example 20 with Chunk

use of net.minecraft.server.v1_16_R3.Chunk in project dynmap by webbukkit.

the class MapChunkCache115 method getLoadedChunk.

// Load generic chunk from existing and already loaded chunk
protected GenericChunk getLoadedChunk(DynmapChunk chunk) {
    CraftWorld cw = (CraftWorld) w;
    NBTTagCompound nbt = null;
    GenericChunk gc = null;
    if (cw.isChunkLoaded(chunk.x, chunk.z)) {
        Chunk c = cw.getHandle().getChunkAt(chunk.x, chunk.z);
        if ((c != null) && c.loaded) {
            nbt = ChunkRegionLoader.saveChunk(cw.getHandle(), c);
        }
        if (nbt != null) {
            gc = parseChunkFromNBT(new NBT.NBTCompound(nbt));
        }
    }
    return gc;
}
Also used : GenericChunk(org.dynmap.common.chunk.GenericChunk) NBTTagCompound(net.minecraft.server.v1_15_R1.NBTTagCompound) GenericChunk(org.dynmap.common.chunk.GenericChunk) Chunk(net.minecraft.server.v1_15_R1.Chunk) DynmapChunk(org.dynmap.DynmapChunk) CraftWorld(org.bukkit.craftbukkit.v1_15_R1.CraftWorld)

Aggregations

ArrayList (java.util.ArrayList)13 List (java.util.List)13 Location (org.bukkit.Location)13 HashMap (java.util.HashMap)12 WildLoadersPlugin (com.bgsoftware.wildloaders.WildLoadersPlugin)8 Hologram (com.bgsoftware.wildloaders.api.holograms.Hologram)8 ChunkLoader (com.bgsoftware.wildloaders.api.loaders.ChunkLoader)8 ChunkLoaderNPC (com.bgsoftware.wildloaders.api.npc.ChunkLoaderNPC)8 ITileEntityChunkLoader (com.bgsoftware.wildloaders.loaders.ITileEntityChunkLoader)8 WChunkLoader (com.bgsoftware.wildloaders.loaders.WChunkLoader)8 Collection (java.util.Collection)8 Collections (java.util.Collections)8 Map (java.util.Map)8 UUID (java.util.UUID)8 Chunk (net.minecraft.server.v1_16_R3.Chunk)8 Chunk (net.minecraft.server.v1_15_R1.Chunk)4 IBlockData (net.minecraft.server.v1_16_R3.IBlockData)4 DynmapChunk (org.dynmap.DynmapChunk)4 GenericChunk (org.dynmap.common.chunk.GenericChunk)4 ChestType (com.bgsoftware.wildchests.api.objects.ChestType)3