Search in sources :

Example 31 with Chunk

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

the class IWorldHandler method setBlockFast.

private void setBlockFast(@NotNull World world, @NotNull BlockPosition position, @NotNull IBlockData data) {
    Chunk chunk = world.getChunkAtWorldCoords(position);
    ChunkSection chunkSection = chunk.getSections()[position.getY() >> 4];
    if (chunkSection == null) {
        // Put a GLASS block to initialize the section. It will be replaced next with the real block.
        chunk.setType(position, Blocks.GLASS.getBlockData(), false);
        chunkSection = chunk.getSections()[position.getY() >> 4];
    }
    if (chunkSection.getType(position.getX() & 15, position.getY() & 15, position.getZ() & 15).equals(data)) {
        // Block is already of correct type and data, don't overwrite
        return;
    }
    chunkSection.setType(position.getX() & 15, position.getY() & 15, position.getZ() & 15, data);
    world.notify(position, data, data, 3);
    var engine = chunk.e();
    if (engine != null)
        engine.a(position);
    chunk.markDirty();
}
Also used : Chunk(net.minecraft.server.v1_14_R1.Chunk) ChunkSection(net.minecraft.server.v1_14_R1.ChunkSection)

Example 32 with Chunk

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

the class IWorldHandler method setBlockFast.

private void setBlockFast(@NotNull World world, @NotNull BlockPosition position, @NotNull IBlockData data) {
    Chunk chunk = world.getChunkAtWorldCoords(position);
    ChunkSection chunkSection = chunk.getSections()[position.getY() >> 4];
    if (chunkSection == null) {
        // Put a GLASS block to initialize the section. It will be replaced next with the real block.
        chunk.setType(position, Blocks.GLASS.getBlockData(), false);
        chunkSection = chunk.getSections()[position.getY() >> 4];
    }
    if (chunkSection.getType(position.getX() & 15, position.getY() & 15, position.getZ() & 15).equals(data)) {
        // Block is already of correct type and data, don't overwrite
        return;
    }
    chunkSection.setType(position.getX() & 15, position.getY() & 15, position.getZ() & 15, data);
    world.notify(position, data, data, 3);
    var engine = chunk.e();
    if (engine != null)
        engine.a(position);
    chunk.markDirty();
}
Also used : Chunk(net.minecraft.server.v1_16_R3.Chunk) ChunkSection(net.minecraft.server.v1_16_R3.ChunkSection)

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