public class CloudBlockRegistry extends Object implements org.cloudburstmc.api.registry.Registry
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
extendBehavior(org.cloudburstmc.api.block.BlockType type,
Function<org.cloudburstmc.api.block.behavior.BlockBehavior,BlockBehaviorDelegate> factory)
Extends current behavior with delegated one provided by the factory.
|
static CloudBlockRegistry |
get() |
org.cloudburstmc.api.block.behavior.BlockBehavior |
getBehavior(org.cloudburstmc.api.block.BlockType blockType) |
org.cloudburstmc.api.block.BlockState |
getBlock(org.cloudburstmc.api.block.BlockType type) |
org.cloudburstmc.api.block.BlockState |
getBlock(org.cloudburstmc.api.util.Identifier identifier) |
org.cloudburstmc.api.block.BlockState |
getBlock(org.cloudburstmc.api.util.Identifier identifier,
int meta) |
org.cloudburstmc.api.block.BlockState |
getBlock(int runtimeId) |
org.cloudburstmc.api.block.BlockState |
getBlock(int id,
int meta) |
org.cloudburstmc.api.block.BlockState |
getBlock(org.cloudburstmc.api.item.ItemStack item) |
org.cloudburstmc.api.block.BlockState |
getBlock(com.nukkitx.nbt.NbtMap tag) |
com.google.common.collect.ImmutableList<org.cloudburstmc.api.block.BlockState> |
getBlockStates() |
int |
getLegacyId(org.cloudburstmc.api.util.Identifier identifier) |
int |
getLegacyId(String name) |
org.cloudburstmc.api.util.Identifier |
getNameFromLegacyId(int id) |
com.nukkitx.nbt.NbtList<com.nukkitx.nbt.NbtMap> |
getPaletteTag() |
com.nukkitx.nbt.NbtMap |
getPropertiesTag() |
int |
getRuntimeId(org.cloudburstmc.api.block.BlockState blockState) |
int |
getRuntimeId(org.cloudburstmc.api.util.Identifier identifier,
int meta) |
int |
getRuntimeId(int id,
int meta) |
void |
overwriteBehavior(org.cloudburstmc.api.block.BlockType type,
org.cloudburstmc.api.block.behavior.BlockBehavior behavior)
Overwrites existing or registers new
BlockBehavior instance if absent |
void |
register(org.cloudburstmc.api.block.BlockType type,
org.cloudburstmc.api.block.behavior.BlockBehavior behavior) |
public static CloudBlockRegistry get()
public void register(org.cloudburstmc.api.block.BlockType type,
org.cloudburstmc.api.block.behavior.BlockBehavior behavior)
throws org.cloudburstmc.api.registry.RegistryException
org.cloudburstmc.api.registry.RegistryExceptionpublic void extendBehavior(org.cloudburstmc.api.block.BlockType type,
Function<org.cloudburstmc.api.block.behavior.BlockBehavior,BlockBehaviorDelegate> factory)
BlockBehavior instance by default.
Extending behavior must extend BlockBehaviorDelegate class accepting
parent behavior as a constructor parameter.
Parent behavior instance is supplied as an argument to the factory function.
type - type to register the behavior forfactory - factory providing BlockBehaviorDelegate instanceorg.cloudburstmc.api.registry.RegistryException - if there's no behavior registered for the specified typepublic void overwriteBehavior(org.cloudburstmc.api.block.BlockType type,
org.cloudburstmc.api.block.behavior.BlockBehavior behavior)
BlockBehavior instance if absenttype - type to register the behavior forbehavior - overwriting behavior instancepublic int getRuntimeId(org.cloudburstmc.api.block.BlockState blockState)
public int getRuntimeId(org.cloudburstmc.api.util.Identifier identifier,
int meta)
public int getRuntimeId(int id,
int meta)
public org.cloudburstmc.api.block.BlockState getBlock(org.cloudburstmc.api.block.BlockType type)
public org.cloudburstmc.api.block.BlockState getBlock(org.cloudburstmc.api.item.ItemStack item)
public org.cloudburstmc.api.block.BlockState getBlock(org.cloudburstmc.api.util.Identifier identifier)
public org.cloudburstmc.api.block.BlockState getBlock(org.cloudburstmc.api.util.Identifier identifier,
int meta)
public org.cloudburstmc.api.block.BlockState getBlock(int id,
int meta)
public org.cloudburstmc.api.block.BlockState getBlock(int runtimeId)
public org.cloudburstmc.api.block.BlockState getBlock(com.nukkitx.nbt.NbtMap tag)
public int getLegacyId(String name)
public int getLegacyId(org.cloudburstmc.api.util.Identifier identifier)
public org.cloudburstmc.api.util.Identifier getNameFromLegacyId(int id)
public void close()
throws org.cloudburstmc.api.registry.RegistryException
close in interface org.cloudburstmc.api.registry.Registryorg.cloudburstmc.api.registry.RegistryExceptionpublic com.nukkitx.nbt.NbtList<com.nukkitx.nbt.NbtMap> getPaletteTag()
public com.nukkitx.nbt.NbtMap getPropertiesTag()
public org.cloudburstmc.api.block.behavior.BlockBehavior getBehavior(org.cloudburstmc.api.block.BlockType blockType)
public com.google.common.collect.ImmutableList<org.cloudburstmc.api.block.BlockState> getBlockStates()
Copyright © 2021. All rights reserved.