Search in sources :

Example 1 with BellBlock

use of net.minecraft.world.level.block.BellBlock in project Denizen-For-Bukkit by DenizenScript.

the class BlockHelperImpl method ringBell.

@Override
public void ringBell(Bell block) {
    org.bukkit.block.data.type.Bell bellData = (org.bukkit.block.data.type.Bell) block.getBlockData();
    Direction face = Direction.byName(bellData.getFacing().name());
    Direction dir = Direction.NORTH;
    switch(bellData.getAttachment()) {
        case DOUBLE_WALL:
        case SINGLE_WALL:
            switch(face) {
                case NORTH:
                case SOUTH:
                    dir = Direction.EAST;
                    break;
            }
            break;
        case FLOOR:
            dir = face;
            break;
    }
    CraftBlock craftBlock = (CraftBlock) block.getBlock();
    ((BellBlock) Blocks.BELL).attemptToRing(craftBlock.getCraftWorld().getHandle(), craftBlock.getPosition(), dir);
}
Also used : BellBlock(net.minecraft.world.level.block.BellBlock) org.bukkit.block(org.bukkit.block) org.bukkit.craftbukkit.v1_17_R1.block(org.bukkit.craftbukkit.v1_17_R1.block) Direction(net.minecraft.core.Direction)

Example 2 with BellBlock

use of net.minecraft.world.level.block.BellBlock in project Denizen-For-Bukkit by DenizenScript.

the class BlockHelperImpl method ringBell.

@Override
public void ringBell(Bell block) {
    org.bukkit.block.data.type.Bell bellData = (org.bukkit.block.data.type.Bell) block.getBlockData();
    Direction face = Direction.byName(bellData.getFacing().name());
    Direction dir = Direction.NORTH;
    switch(bellData.getAttachment()) {
        case DOUBLE_WALL:
        case SINGLE_WALL:
            switch(face) {
                case NORTH:
                case SOUTH:
                    dir = Direction.EAST;
                    break;
            }
            break;
        case FLOOR:
            dir = face;
            break;
    }
    CraftBlock craftBlock = (CraftBlock) block.getBlock();
    ((BellBlock) Blocks.BELL).attemptToRing(craftBlock.getCraftWorld().getHandle(), craftBlock.getPosition(), dir);
}
Also used : BellBlock(net.minecraft.world.level.block.BellBlock) org.bukkit.block(org.bukkit.block) org.bukkit.craftbukkit.v1_18_R1.block(org.bukkit.craftbukkit.v1_18_R1.block) Direction(net.minecraft.core.Direction)

Aggregations

Direction (net.minecraft.core.Direction)2 BellBlock (net.minecraft.world.level.block.BellBlock)2 org.bukkit.block (org.bukkit.block)2 org.bukkit.craftbukkit.v1_17_R1.block (org.bukkit.craftbukkit.v1_17_R1.block)1 org.bukkit.craftbukkit.v1_18_R1.block (org.bukkit.craftbukkit.v1_18_R1.block)1