Search in sources :

Example 26 with TileEntity

use of net.minecraft.server.v1_14_R1.TileEntity in project Denizen-For-Bukkit by DenizenScript.

the class BlockData_v1_10_R1 method setBlock.

public void setBlock(Block block) {
    block.setTypeIdAndData(material.getId(), (byte) data, false);
    if (ctag != null) {
        CompoundTagBuilder builder = ctag.createBuilder();
        builder.putInt("x", block.getX());
        builder.putInt("y", block.getY());
        builder.putInt("z", block.getZ());
        ctag = (CompoundTag_v1_10_R1) builder.build();
        // TODO: make this work!
        BlockPosition blockPos = new BlockPosition(block.getX(), block.getY(), block.getZ());
        TileEntity te = ((CraftWorld) block.getWorld()).getHandle().getTileEntity(blockPos);
        te.a(ctag.toNMSTag());
    }
}
Also used : TileEntity(net.minecraft.server.v1_10_R1.TileEntity) BlockPosition(net.minecraft.server.v1_10_R1.BlockPosition) CompoundTagBuilder(net.aufdemrand.denizen.nms.util.jnbt.CompoundTagBuilder)

Example 27 with TileEntity

use of net.minecraft.server.v1_14_R1.TileEntity in project Denizen-For-Bukkit by DenizenScript.

the class BlockHelper_v1_11_R1 method setNbtData.

@Override
public void setNbtData(Block block, CompoundTag compoundTag) {
    TileEntity tileEntity = ((CraftBlockState) block.getState()).getTileEntity();
    if (tileEntity == null) {
        return;
    }
    tileEntity.a(((CompoundTag_v1_11_R1) compoundTag).toNMSTag());
    tileEntity.update();
}
Also used : TileEntity(net.minecraft.server.v1_11_R1.TileEntity) CraftBlockState(org.bukkit.craftbukkit.v1_11_R1.block.CraftBlockState)

Example 28 with TileEntity

use of net.minecraft.server.v1_14_R1.TileEntity in project Denizen-For-Bukkit by DenizenScript.

the class BlockData_v1_9_R2 method setBlock.

public void setBlock(Block block) {
    block.setTypeIdAndData(material.getId(), (byte) data, false);
    if (ctag != null) {
        CompoundTagBuilder builder = ctag.createBuilder();
        builder.putInt("x", block.getX());
        builder.putInt("y", block.getY());
        builder.putInt("z", block.getZ());
        ctag = (CompoundTag_v1_9_R2) builder.build();
        // TODO: make this work!
        BlockPosition blockPos = new BlockPosition(block.getX(), block.getY(), block.getZ());
        TileEntity te = ((CraftWorld) block.getWorld()).getHandle().getTileEntity(blockPos);
        te.a(ctag.toNMSTag());
    }
}
Also used : TileEntity(net.minecraft.server.v1_9_R2.TileEntity) BlockPosition(net.minecraft.server.v1_9_R2.BlockPosition) CompoundTagBuilder(net.aufdemrand.denizen.nms.util.jnbt.CompoundTagBuilder)

Example 29 with TileEntity

use of net.minecraft.server.v1_14_R1.TileEntity in project Denizen-For-Bukkit by DenizenScript.

the class BlockHelper_v1_10_R1 method setNbtData.

@Override
public void setNbtData(Block block, CompoundTag compoundTag) {
    TileEntity tileEntity = ((CraftBlockState) block.getState()).getTileEntity();
    if (tileEntity == null) {
        return;
    }
    tileEntity.a(((CompoundTag_v1_10_R1) compoundTag).toNMSTag());
    tileEntity.update();
}
Also used : TileEntity(net.minecraft.server.v1_10_R1.TileEntity) CraftBlockState(org.bukkit.craftbukkit.v1_10_R1.block.CraftBlockState)

Example 30 with TileEntity

use of net.minecraft.server.v1_14_R1.TileEntity in project RoseStacker by Rosewood-Development.

the class NMSHandlerImpl method injectStackedSpawnerTile.

@Override
public StackedSpawnerTile injectStackedSpawnerTile(Object stackedSpawnerObj) {
    StackedSpawner stackedSpawner = (StackedSpawner) stackedSpawnerObj;
    Block block = stackedSpawner.getBlock();
    WorldServer level = ((CraftWorld) block.getWorld()).getHandle();
    TileEntity blockEntity = level.getTileEntity(new BlockPosition(block.getX(), block.getY(), block.getZ()));
    if (blockEntity instanceof TileEntityMobSpawner) {
        TileEntityMobSpawner spawnerBlockEntity = (TileEntityMobSpawner) blockEntity;
        if (!(spawnerBlockEntity.getSpawner() instanceof StackedSpawnerTileImpl)) {
            StackedSpawnerTile stackedSpawnerTile = new StackedSpawnerTileImpl(spawnerBlockEntity.getSpawner(), spawnerBlockEntity, stackedSpawner);
            unsafe.putObject(spawnerBlockEntity, field_SpawnerBlockEntity_spawner_offset, stackedSpawnerTile);
            return stackedSpawnerTile;
        } else {
            StackedSpawnerTileImpl spawnerTile = (StackedSpawnerTileImpl) spawnerBlockEntity.getSpawner();
            spawnerTile.updateStackedSpawner(stackedSpawner);
            return spawnerTile;
        }
    }
    return null;
}
Also used : TileEntity(net.minecraft.server.v1_16_R3.TileEntity) StackedSpawner(dev.rosewood.rosestacker.stack.StackedSpawner) BlockPosition(net.minecraft.server.v1_16_R3.BlockPosition) Block(org.bukkit.block.Block) WorldServer(net.minecraft.server.v1_16_R3.WorldServer) TileEntityMobSpawner(net.minecraft.server.v1_16_R3.TileEntityMobSpawner) StackedSpawnerTileImpl(dev.rosewood.rosestacker.nms.v1_16_R3.spawner.StackedSpawnerTileImpl) StackedSpawnerTile(dev.rosewood.rosestacker.nms.spawner.StackedSpawnerTile) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld)

Aggregations

Chunk (org.bukkit.Chunk)15 Location (org.bukkit.Location)14 ArrayList (java.util.ArrayList)10 HashMap (java.util.HashMap)10 Map (java.util.Map)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 UUID (java.util.UUID)8 BlockPosition (net.minecraft.server.v1_16_R3.BlockPosition)8 TileEntity (net.minecraft.server.v1_16_R3.TileEntity)8 CraftWorld (org.bukkit.craftbukkit.v1_16_R3.CraftWorld)7 List (java.util.List)6 TileEntity (net.minecraft.server.v1_8_R3.TileEntity)6 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)5