Search in sources :

Example 1 with TileEntity

use of net.minecraft.server.v1_8_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_8_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_8_R3.TileEntity in project Denizen-For-Bukkit by DenizenScript.

the class BlockHelper_v1_8_R3 method setPlayerProfile.

@Override
public void setPlayerProfile(Skull skull, PlayerProfile playerProfile) {
    GameProfile gameProfile = new GameProfile(playerProfile.getUniqueId(), playerProfile.getName());
    if (playerProfile.hasTexture()) {
        gameProfile.getProperties().put("textures", new Property("textures", playerProfile.getTexture(), playerProfile.getTextureSignature()));
    }
    TileEntitySkull tileEntity = ((CraftSkull) skull).getTileEntity();
    tileEntity.setSkullType(SkullType.PLAYER.ordinal());
    tileEntity.setGameProfile(gameProfile);
    skull.getBlock().getState().update();
}
Also used : GameProfile(com.mojang.authlib.GameProfile) CraftSkull(org.bukkit.craftbukkit.v1_8_R3.block.CraftSkull) TileEntitySkull(net.minecraft.server.v1_8_R3.TileEntitySkull) Property(com.mojang.authlib.properties.Property)

Example 4 with TileEntity

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

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

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 GameProfile (com.mojang.authlib.GameProfile)1 Property (com.mojang.authlib.properties.Property)1 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 TileEntitySkull (net.minecraft.server.v1_8_R3.TileEntitySkull)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 CraftSkull (org.bukkit.craftbukkit.v1_8_R3.block.CraftSkull)1 CraftBlockState (org.bukkit.craftbukkit.v1_9_R2.block.CraftBlockState)1