Search in sources :

Example 21 with Chunk

use of net.minecraft.server.v1_8_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 22 with Chunk

use of net.minecraft.server.v1_8_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 23 with Chunk

use of net.minecraft.server.v1_8_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)

Example 24 with Chunk

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

the class MapChunkCache114_1 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_14_R1.NBTTagCompound) GenericChunk(org.dynmap.common.chunk.GenericChunk) Chunk(net.minecraft.server.v1_14_R1.Chunk) DynmapChunk(org.dynmap.DynmapChunk) CraftWorld(org.bukkit.craftbukkit.v1_14_R1.CraftWorld)

Example 25 with Chunk

use of net.minecraft.server.v1_8_R3.Chunk in project WildLoaders by BG-Software-LLC.

the class NMSAdapter_v1_8_R3 method removeLoader.

@Override
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
    Location loaderLoc = chunkLoader.getLocation();
    World world = ((CraftWorld) loaderLoc.getWorld()).getHandle();
    BlockPosition blockPosition = new BlockPosition(loaderLoc.getX(), loaderLoc.getY(), loaderLoc.getZ());
    long tileEntityLong = LongHash.toLong(blockPosition.getX() >> 4, blockPosition.getZ() >> 4);
    TileEntityChunkLoader tileEntityChunkLoader = TileEntityChunkLoader.tileEntityChunkLoaderMap.remove(tileEntityLong);
    if (tileEntityChunkLoader != null) {
        tileEntityChunkLoader.holograms.forEach(EntityHolograms_v1_8_R3::removeHologram);
        tileEntityChunkLoader.removed = true;
        world.tileEntityList.remove(tileEntityChunkLoader);
    }
    if (spawnParticle)
        world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
    for (org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
        Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
        chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
            NBTTagCompound nbtTagCompound = new NBTTagCompound();
            tileEntity.b(nbtTagCompound);
            nbtTagCompound.setShort("RequiredPlayerRange", (short) 16);
            tileEntity.a(nbtTagCompound);
        });
    }
}
Also used : ChunkLoader(com.bgsoftware.wildloaders.api.loaders.ChunkLoader) NBTTagList(net.minecraft.server.v1_8_R3.NBTTagList) NBTTagCompound(net.minecraft.server.v1_8_R3.NBTTagCompound) HashMap(java.util.HashMap) IUpdatePlayerListBox(net.minecraft.server.v1_8_R3.IUpdatePlayerListBox) ArrayList(java.util.ArrayList) WChunkLoader(com.bgsoftware.wildloaders.loaders.WChunkLoader) Location(org.bukkit.Location) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld) Map(java.util.Map) TileEntityMobSpawner(net.minecraft.server.v1_8_R3.TileEntityMobSpawner) WildLoadersPlugin(com.bgsoftware.wildloaders.WildLoadersPlugin) LongHash(org.bukkit.craftbukkit.v1_8_R3.util.LongHash) ITileEntityChunkLoader(com.bgsoftware.wildloaders.loaders.ITileEntityChunkLoader) ItemStack(net.minecraft.server.v1_8_R3.ItemStack) TileEntity(net.minecraft.server.v1_8_R3.TileEntity) Hologram(com.bgsoftware.wildloaders.api.holograms.Hologram) CraftItemStack(org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack) NBTTagLong(net.minecraft.server.v1_8_R3.NBTTagLong) CraftChunk(org.bukkit.craftbukkit.v1_8_R3.CraftChunk) Collection(java.util.Collection) UUID(java.util.UUID) Block(net.minecraft.server.v1_8_R3.Block) World(net.minecraft.server.v1_8_R3.World) List(java.util.List) Chunk(net.minecraft.server.v1_8_R3.Chunk) ChunkLoaderNPC(com.bgsoftware.wildloaders.api.npc.ChunkLoaderNPC) BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) Collections(java.util.Collections) NBTTagString(net.minecraft.server.v1_8_R3.NBTTagString) BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) NBTTagCompound(net.minecraft.server.v1_8_R3.NBTTagCompound) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld) World(net.minecraft.server.v1_8_R3.World) CraftChunk(org.bukkit.craftbukkit.v1_8_R3.CraftChunk) Chunk(net.minecraft.server.v1_8_R3.Chunk) ITileEntityChunkLoader(com.bgsoftware.wildloaders.loaders.ITileEntityChunkLoader) TileEntityMobSpawner(net.minecraft.server.v1_8_R3.TileEntityMobSpawner) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld) CraftChunk(org.bukkit.craftbukkit.v1_8_R3.CraftChunk) Location(org.bukkit.Location)

Aggregations

Location (org.bukkit.Location)13 ArrayList (java.util.ArrayList)11 List (java.util.List)11 HashMap (java.util.HashMap)10 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 CraftChunk (org.bukkit.craftbukkit.v1_8_R3.CraftChunk)7 BlockPosition (net.minecraft.server.v1_8_R3.BlockPosition)6 Chunk (net.minecraft.server.v1_15_R1.Chunk)4 IBlockData (net.minecraft.server.v1_8_R3.IBlockData)4 CraftWorld (org.bukkit.craftbukkit.v1_8_R3.CraftWorld)4