use of org.bukkit.craftbukkit.v1_16_R3.block.CraftBlockState in project Magma-1.16.x by magmafoundation.
the class CraftEventFactory method handleBlockGrowEvent.
public static boolean handleBlockGrowEvent(World world, BlockPos pos, net.minecraft.block.BlockState newData, int flag) {
Block block = world.getWorldCB().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
CraftBlockState state = (CraftBlockState) block.getState();
state.setData(newData);
BlockGrowEvent event = new BlockGrowEvent(block, state);
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
state.update(true);
}
return !event.isCancelled();
}
use of org.bukkit.craftbukkit.v1_16_R3.block.CraftBlockState in project Magma-1.16.x by magmafoundation.
the class CraftEventFactory method handleBlockSpreadEvent.
public static boolean handleBlockSpreadEvent(World world, BlockPos source, BlockPos target, net.minecraft.block.BlockState block, int flag) {
CraftBlockState state = CraftBlockState.getBlockState(world, target, flag);
state.setData(block);
BlockSpreadEvent event = new BlockSpreadEvent(world.getWorldCB().getBlockAt(target.getX(), target.getY(), target.getZ()), world.getWorldCB().getBlockAt(source.getX(), source.getY(), source.getZ()), state);
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
state.update(true);
}
return !event.isCancelled();
}
use of org.bukkit.craftbukkit.v1_16_R3.block.CraftBlockState in project Magma-1.16.x by magmafoundation.
the class CraftEventFactory method handleBlockFormEvent.
public static boolean handleBlockFormEvent(World world, BlockPos pos, net.minecraft.block.BlockState block, int flag, @Nullable Entity entity) {
CraftBlockState blockState = CraftBlockState.getBlockState(world, pos, flag);
blockState.setData(block);
BlockFormEvent event = (entity == null) ? new BlockFormEvent(blockState.getBlock(), blockState) : new EntityBlockFormEvent(entity.getBukkitEntity(), blockState.getBlock(), blockState);
world.getServerCB().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
blockState.update(true);
}
return !event.isCancelled();
}
use of org.bukkit.craftbukkit.v1_16_R3.block.CraftBlockState in project LoliServer by Loli-Server.
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.remove(pos);
list.put(pos.immutable(), state);
return true;
}
use of org.bukkit.craftbukkit.v1_16_R3.block.CraftBlockState in project LoliServer by Loli-Server.
the class CraftEventFactory method handleBlockSpreadEvent.
public static boolean handleBlockSpreadEvent(World world, BlockPos source, BlockPos target, net.minecraft.block.BlockState block, int flag) {
CraftBlockState state = CraftBlockState.getBlockState(world, target, flag);
state.setData(block);
BlockSpreadEvent event = new BlockSpreadEvent(world.getWorld().getBlockAt(target.getX(), target.getY(), target.getZ()), world.getWorld().getBlockAt(source.getX(), source.getY(), source.getZ()), state);
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
state.update(true);
}
return !event.isCancelled();
}
Aggregations