Search in sources :

Example 6 with CraftBlockData

use of org.bukkit.craftbukkit.v1_18_R2.block.data.CraftBlockData in project Movecraft by APDevTeam.

the class IWorldHandler method setBlockFast.

@Override
public void setBlockFast(@NotNull Location location, @NotNull MovecraftRotation rotation, @NotNull BlockData data) {
    BlockState blockData;
    if (data instanceof CraftBlockData) {
        blockData = ((CraftBlockData) data).getState();
    } else {
        blockData = (BlockState) data;
    }
    blockData = blockData.rotate(ROTATION[rotation.ordinal()]);
    Level world = ((CraftWorld) (location.getWorld())).getHandle();
    BlockPos BlockPos = locationToPosition(MathUtils.bukkit2MovecraftLoc(location));
    setBlockFast(world, BlockPos, blockData);
}
Also used : CraftBlockData(org.bukkit.craftbukkit.v1_18_R2.block.data.CraftBlockData) BlockState(net.minecraft.world.level.block.state.BlockState) ServerLevel(net.minecraft.server.level.ServerLevel) Level(net.minecraft.world.level.Level) BlockPos(net.minecraft.core.BlockPos) CraftWorld(org.bukkit.craftbukkit.v1_18_R2.CraftWorld)

Example 7 with CraftBlockData

use of org.bukkit.craftbukkit.v1_18_R2.block.data.CraftBlockData in project Movecraft by APDevTeam.

the class IWorldHandler method setBlockFast.

@Override
public void setBlockFast(@NotNull Location location, @NotNull MovecraftRotation rotation, @NotNull BlockData data) {
    IBlockData blockData;
    if (data instanceof CraftBlockData) {
        blockData = ((CraftBlockData) data).getState();
    } else {
        blockData = (IBlockData) data;
    }
    blockData = blockData.a(ROTATION[rotation.ordinal()]);
    World world = ((CraftWorld) (location.getWorld())).getHandle();
    BlockPosition blockPosition = locationToPosition(bukkit2MovecraftLoc(location));
    setBlockFast(world, blockPosition, blockData);
}
Also used : CraftBlockData(org.bukkit.craftbukkit.v1_16_R3.block.data.CraftBlockData) IBlockData(net.minecraft.server.v1_16_R3.IBlockData) BlockPosition(net.minecraft.server.v1_16_R3.BlockPosition) World(net.minecraft.server.v1_16_R3.World) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld)

Example 8 with CraftBlockData

use of org.bukkit.craftbukkit.v1_18_R2.block.data.CraftBlockData in project Movecraft by APDevTeam.

the class IWorldHandler method setBlockFast.

@Override
public void setBlockFast(@NotNull Location location, @NotNull MovecraftRotation rotation, @NotNull BlockData data) {
    BlockState blockData;
    if (data instanceof CraftBlockData) {
        blockData = ((CraftBlockData) data).getState();
    } else {
        blockData = (BlockState) data;
    }
    blockData = blockData.rotate(ROTATION[rotation.ordinal()]);
    Level world = ((CraftWorld) (location.getWorld())).getHandle();
    BlockPos BlockPos = locationToPosition(MathUtils.bukkit2MovecraftLoc(location));
    setBlockFast(world, BlockPos, blockData);
}
Also used : CraftBlockData(org.bukkit.craftbukkit.v1_17_R1.block.data.CraftBlockData) BlockState(net.minecraft.world.level.block.state.BlockState) ServerLevel(net.minecraft.server.level.ServerLevel) Level(net.minecraft.world.level.Level) BlockPos(net.minecraft.core.BlockPos) CraftWorld(org.bukkit.craftbukkit.v1_17_R1.CraftWorld)

Example 9 with CraftBlockData

use of org.bukkit.craftbukkit.v1_18_R2.block.data.CraftBlockData in project Movecraft by APDevTeam.

the class IWorldHandler method setBlockFast.

@Override
public void setBlockFast(@NotNull Location location, @NotNull MovecraftRotation rotation, @NotNull BlockData data) {
    IBlockData blockData;
    if (data instanceof CraftBlockData) {
        blockData = ((CraftBlockData) data).getState();
    } else {
        blockData = (IBlockData) data;
    }
    blockData = blockData.a(ROTATION[rotation.ordinal()]);
    World world = ((CraftWorld) (location.getWorld())).getHandle();
    BlockPosition blockPosition = locationToPosition(bukkit2MovecraftLoc(location));
    setBlockFast(world, blockPosition, blockData);
}
Also used : CraftBlockData(org.bukkit.craftbukkit.v1_14_R1.block.data.CraftBlockData) IBlockData(net.minecraft.server.v1_14_R1.IBlockData) BlockPosition(net.minecraft.server.v1_14_R1.BlockPosition) World(net.minecraft.server.v1_14_R1.World) CraftWorld(org.bukkit.craftbukkit.v1_14_R1.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_14_R1.CraftWorld)

Example 10 with CraftBlockData

use of org.bukkit.craftbukkit.v1_18_R2.block.data.CraftBlockData in project BentoBox by BentoBoxWorld.

the class NMSHandler method setBlockInNativeChunk.

@Override
public void setBlockInNativeChunk(org.bukkit.Chunk chunk, int x, int y, int z, BlockData blockData, boolean applyPhysics) {
    CraftBlockData craft = (CraftBlockData) blockData;
    World nmsWorld = ((CraftWorld) chunk.getWorld()).getHandle();
    Chunk nmsChunk = nmsWorld.d(chunk.getX(), chunk.getZ());
    BlockPosition bp = new BlockPosition((chunk.getX() << 4) + x, y, (chunk.getZ() << 4) + z);
    // Setting the block to air before setting to another state prevents some console errors
    nmsChunk.a(bp, AIR, applyPhysics);
    nmsChunk.a(bp, craft.getState(), applyPhysics);
}
Also used : CraftBlockData(org.bukkit.craftbukkit.v1_18_R1.block.data.CraftBlockData) BlockPosition(net.minecraft.core.BlockPosition) World(net.minecraft.world.level.World) CraftWorld(org.bukkit.craftbukkit.v1_18_R1.CraftWorld) Chunk(net.minecraft.world.level.chunk.Chunk) CraftWorld(org.bukkit.craftbukkit.v1_18_R1.CraftWorld)

Aggregations

BlockData (org.bukkit.block.data.BlockData)12 BlockState (net.minecraft.world.level.block.state.BlockState)11 CraftBlockData (org.bukkit.craftbukkit.v1_16_R3.block.data.CraftBlockData)9 CraftBlockData (org.bukkit.craftbukkit.v1_15_R1.block.data.CraftBlockData)8 Nullable (org.jetbrains.annotations.Nullable)6 BlockPosition (net.minecraft.server.v1_15_R1.BlockPosition)4 FallingBlockEntity (net.minecraft.world.entity.item.FallingBlockEntity)4 ParallelWorld (thpmc.engine.api.world.parallel.ParallelWorld)4 ParallelWorld (thpmc.vanilla_source.api.world.parallel.ParallelWorld)4 BlockPos (net.minecraft.core.BlockPos)3 ServerLevel (net.minecraft.server.level.ServerLevel)3 BlockPosition (net.minecraft.server.v1_16_R3.BlockPosition)3 CraftBlockData (org.bukkit.craftbukkit.v1_17_R1.block.data.CraftBlockData)3 CraftBlockData (org.bukkit.craftbukkit.v1_18_R1.block.data.CraftBlockData)3 CraftBlockData (org.bukkit.craftbukkit.v1_18_R2.block.data.CraftBlockData)3 ParallelUniverse (thpmc.engine.api.world.parallel.ParallelUniverse)3 ParallelUniverse (thpmc.vanilla_source.api.world.parallel.ParallelUniverse)3 java.util (java.util)2 List (java.util.List)2 BlockState (net.minecraft.block.BlockState)2