Search in sources :

Example 1 with BlockMaterial

use of com.sk89q.worldedit.world.registry.BlockMaterial in project FastAsyncWorldEdit by IntellectualSites.

the class BukkitBlockRegistry method getMaterial.

@Nullable
@Override
public BlockMaterial getMaterial(BlockType blockType) {
    // FAWE start - delegate to our internal values
    BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
    if (adapter != null) {
        BlockMaterial result = adapter.getMaterial(blockType);
        if (result != null) {
            return result;
        }
    }
    Material mat = BukkitAdapter.adapt(blockType);
    if (mat == null) {
        return new PassthroughBlockMaterial(null);
    }
    if (materialMap == null) {
        materialMap = new BukkitBlockMaterial[Material.values().length];
    }
    BukkitBlockMaterial result = materialMap[mat.ordinal()];
    if (result == null) {
        result = new BukkitBlockMaterial(BukkitBlockRegistry.super.getMaterial(blockType), mat);
        materialMap[mat.ordinal()] = result;
    }
    return result;
// FAWE end
}
Also used : PassthroughBlockMaterial(com.sk89q.worldedit.world.registry.PassthroughBlockMaterial) BlockMaterial(com.sk89q.worldedit.world.registry.BlockMaterial) PassthroughBlockMaterial(com.sk89q.worldedit.world.registry.PassthroughBlockMaterial) BukkitImplAdapter(com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter) PassthroughBlockMaterial(com.sk89q.worldedit.world.registry.PassthroughBlockMaterial) BlockMaterial(com.sk89q.worldedit.world.registry.BlockMaterial) Material(org.bukkit.Material) Nullable(javax.annotation.Nullable)

Example 2 with BlockMaterial

use of com.sk89q.worldedit.world.registry.BlockMaterial in project FastAsyncWorldEdit by IntellectualSites.

the class CharFilterBlock method hasNbtData.

@Override
public boolean hasNbtData() {
    final BlockState state = getBlock();
    final BlockMaterial material = state.getMaterial();
    return material.hasContainer();
}
Also used : BlockState(com.sk89q.worldedit.world.block.BlockState) BlockMaterial(com.sk89q.worldedit.world.registry.BlockMaterial)

Example 3 with BlockMaterial

use of com.sk89q.worldedit.world.registry.BlockMaterial in project FastAsyncWorldEdit by IntellectualSites.

the class CharFilterBlock method getFullBlock.

@Override
public final BaseBlock getFullBlock() {
    final BlockState state = getBlock();
    final BlockMaterial material = state.getMaterial();
    if (material.hasContainer()) {
        final CompoundTag tag = get.getTile(x, y + yy, z);
        return state.toBaseBlock(tag);
    }
    return state.toBaseBlock();
}
Also used : BlockState(com.sk89q.worldedit.world.block.BlockState) BlockMaterial(com.sk89q.worldedit.world.registry.BlockMaterial) CompoundTag(com.sk89q.jnbt.CompoundTag)

Aggregations

BlockMaterial (com.sk89q.worldedit.world.registry.BlockMaterial)3 BlockState (com.sk89q.worldedit.world.block.BlockState)2 CompoundTag (com.sk89q.jnbt.CompoundTag)1 BukkitImplAdapter (com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter)1 PassthroughBlockMaterial (com.sk89q.worldedit.world.registry.PassthroughBlockMaterial)1 Nullable (javax.annotation.Nullable)1 Material (org.bukkit.Material)1