Search in sources :

Example 1 with PassthroughBlockMaterial

use of com.sk89q.worldedit.world.registry.PassthroughBlockMaterial 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)

Aggregations

BukkitImplAdapter (com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter)1 BlockMaterial (com.sk89q.worldedit.world.registry.BlockMaterial)1 PassthroughBlockMaterial (com.sk89q.worldedit.world.registry.PassthroughBlockMaterial)1 Nullable (javax.annotation.Nullable)1 Material (org.bukkit.Material)1