Search in sources :

Example 1 with TileEntity

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

the class BlockData_v1_11_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_11_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_11_R1.TileEntity) BlockPosition(net.minecraft.server.v1_11_R1.BlockPosition) CompoundTagBuilder(net.aufdemrand.denizen.nms.util.jnbt.CompoundTagBuilder)

Example 2 with TileEntity

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

the class BlockHelper_v1_8_R3 method setNbtData.

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

Example 3 with TileEntity

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

the class BlockHelper_v1_9_R2 method setNbtData.

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

Example 4 with TileEntity

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

the class BlockData_v1_8_R3 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_8_R3) 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_8_R3.TileEntity) BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) CompoundTagBuilder(net.aufdemrand.denizen.nms.util.jnbt.CompoundTagBuilder)

Example 5 with TileEntity

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

the class BlockHelper_v1_8_R3 method getNbtData.

@Override
public CompoundTag getNbtData(Block block) {
    TileEntity tileEntity = ((CraftBlockState) block.getState()).getTileEntity();
    if (tileEntity == null) {
        return null;
    }
    NBTTagCompound nbtTagCompound = new NBTTagCompound();
    tileEntity.b(new NBTTagCompound());
    return CompoundTag_v1_8_R3.fromNMSTag(nbtTagCompound);
}
Also used : TileEntity(net.minecraft.server.v1_8_R3.TileEntity) CraftBlockState(org.bukkit.craftbukkit.v1_8_R3.block.CraftBlockState) NBTTagCompound(net.minecraft.server.v1_8_R3.NBTTagCompound)

Aggregations

CompoundTagBuilder (net.aufdemrand.denizen.nms.util.jnbt.CompoundTagBuilder)4 TileEntity (net.minecraft.server.v1_8_R3.TileEntity)3 TileEntity (net.minecraft.server.v1_10_R1.TileEntity)2 TileEntity (net.minecraft.server.v1_11_R1.TileEntity)2 TileEntity (net.minecraft.server.v1_9_R2.TileEntity)2 CraftBlockState (org.bukkit.craftbukkit.v1_8_R3.block.CraftBlockState)2 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)1 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)1 BlockPosition (net.minecraft.server.v1_8_R3.BlockPosition)1 NBTTagCompound (net.minecraft.server.v1_8_R3.NBTTagCompound)1 BlockPosition (net.minecraft.server.v1_9_R2.BlockPosition)1 CraftBlockState (org.bukkit.craftbukkit.v1_10_R1.block.CraftBlockState)1 CraftBlockState (org.bukkit.craftbukkit.v1_11_R1.block.CraftBlockState)1 CraftBlockState (org.bukkit.craftbukkit.v1_9_R2.block.CraftBlockState)1