Search in sources :

Example 16 with CraftBlockState

use of org.bukkit.craftbukkit.v1_17_R1.block.CraftBlockState 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)

Example 17 with CraftBlockState

use of org.bukkit.craftbukkit.v1_17_R1.block.CraftBlockState 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 18 with CraftBlockState

use of org.bukkit.craftbukkit.v1_17_R1.block.CraftBlockState 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 19 with CraftBlockState

use of org.bukkit.craftbukkit.v1_17_R1.block.CraftBlockState in project Denizen by DenizenScript.

the class BlockHelperImpl method generateBlockState.

@Override
public org.bukkit.block.BlockState generateBlockState(Block block, Material mat) {
    CraftBlockState state = new CraftBlockState(block);
    state.setData(CraftMagicNumbers.getBlock(mat).getBlockData());
    return state;
}
Also used : CraftBlockState(org.bukkit.craftbukkit.v1_16_R3.block.CraftBlockState)

Example 20 with CraftBlockState

use of org.bukkit.craftbukkit.v1_17_R1.block.CraftBlockState in project Magma-1.16.x by magmafoundation.

the class BlockStateListPopulator method setBlock.

@Override
public boolean setBlock(BlockPos pos, BlockState newState, int flags) {
    CraftBlockState state = CraftBlockState.getBlockState(world, pos, flags);
    state.setData(newState);
    list.put(pos, state);
    return true;
}
Also used : CraftBlockState(org.bukkit.craftbukkit.v1_16_R3.block.CraftBlockState)

Aggregations

CraftBlockState (org.bukkit.craftbukkit.v1_16_R3.block.CraftBlockState)16 CraftBlockState (org.bukkit.craftbukkit.v1_18_R2.block.CraftBlockState)8 Block (org.bukkit.block.Block)7 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 List (java.util.List)3 BlockState (net.minecraft.world.level.block.state.BlockState)3 BlockFadeEvent (org.bukkit.event.block.BlockFadeEvent)3 BlockFormEvent (org.bukkit.event.block.BlockFormEvent)3 BlockGrowEvent (org.bukkit.event.block.BlockGrowEvent)3 BlockSpreadEvent (org.bukkit.event.block.BlockSpreadEvent)3 EntityBlockFormEvent (org.bukkit.event.block.EntityBlockFormEvent)3 MoistureChangeEvent (org.bukkit.event.block.MoistureChangeEvent)3 NotNull (org.jetbrains.annotations.NotNull)3 TileEntity (net.minecraft.server.v1_8_R3.TileEntity)2 BlockPos (net.minecraft.util.math.BlockPos)2 CraftBlock (org.bukkit.craftbukkit.v1_16_R3.block.CraftBlock)2 CraftBlock (org.bukkit.craftbukkit.v1_18_R2.block.CraftBlock)2 CraftBlockState (org.bukkit.craftbukkit.v1_8_R3.block.CraftBlockState)2 BlockPos (net.minecraft.core.BlockPos)1