Package org.cloudburstmc.server.registry
Class CloudBlockRegistry
java.lang.Object
org.cloudburstmc.server.registry.CloudBlockRegistry
- All Implemented Interfaces:
org.cloudburstmc.api.registry.Registry
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidextendBehavior(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 CloudBlockRegistryget()org.cloudburstmc.api.block.behavior.BlockBehaviorgetBehavior(org.cloudburstmc.api.block.BlockType blockType)org.cloudburstmc.api.block.BlockStategetBlock(int runtimeId)org.cloudburstmc.api.block.BlockStategetBlock(int id, int meta)org.cloudburstmc.api.block.BlockStategetBlock(com.nukkitx.nbt.NbtMap tag)org.cloudburstmc.api.block.BlockStategetBlock(org.cloudburstmc.api.block.BlockType type)org.cloudburstmc.api.block.BlockStategetBlock(org.cloudburstmc.api.item.ItemStack item)org.cloudburstmc.api.block.BlockStategetBlock(org.cloudburstmc.api.util.Identifier identifier)org.cloudburstmc.api.block.BlockStategetBlock(org.cloudburstmc.api.util.Identifier identifier, int meta)com.google.common.collect.ImmutableList<org.cloudburstmc.api.block.BlockState>intgetLegacyId(String name)intgetLegacyId(org.cloudburstmc.api.util.Identifier identifier)org.cloudburstmc.api.util.IdentifiergetNameFromLegacyId(int id)com.nukkitx.nbt.NbtList<com.nukkitx.nbt.NbtMap>com.nukkitx.nbt.NbtMapintgetRuntimeId(int id, int meta)intgetRuntimeId(org.cloudburstmc.api.block.BlockState blockState)intgetRuntimeId(org.cloudburstmc.api.util.Identifier identifier, int meta)voidoverwriteBehavior(org.cloudburstmc.api.block.BlockType type, org.cloudburstmc.api.block.behavior.BlockBehavior behavior)Overwrites existing or registers newBlockBehaviorinstance if absentvoidregister(org.cloudburstmc.api.block.BlockType type, org.cloudburstmc.api.block.behavior.BlockBehavior behavior)
-
Method Details
-
get
-
register
public void register(org.cloudburstmc.api.block.BlockType type, org.cloudburstmc.api.block.behavior.BlockBehavior behavior) throws org.cloudburstmc.api.registry.RegistryException- Throws:
org.cloudburstmc.api.registry.RegistryException
-
extendBehavior
public 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. All methods are delegated to the previousBlockBehaviorinstance by default.Extending behavior must extend
BlockBehaviorDelegateclass accepting parent behavior as a constructor parameter. Parent behavior instance is supplied as an argument to the factory function.- Parameters:
type- type to register the behavior forfactory- factory providing BlockBehaviorDelegate instance- Throws:
org.cloudburstmc.api.registry.RegistryException- if there's no behavior registered for the specified type
-
overwriteBehavior
public void overwriteBehavior(org.cloudburstmc.api.block.BlockType type, org.cloudburstmc.api.block.behavior.BlockBehavior behavior)Overwrites existing or registers newBlockBehaviorinstance if absent- Parameters:
type- type to register the behavior forbehavior- overwriting behavior instance
-
getRuntimeId
public int getRuntimeId(org.cloudburstmc.api.block.BlockState blockState) -
getRuntimeId
public int getRuntimeId(org.cloudburstmc.api.util.Identifier identifier, int meta) -
getRuntimeId
public int getRuntimeId(int id, int meta) -
getBlock
public org.cloudburstmc.api.block.BlockState getBlock(org.cloudburstmc.api.block.BlockType type) -
getBlock
public org.cloudburstmc.api.block.BlockState getBlock(org.cloudburstmc.api.item.ItemStack item) -
getBlock
public org.cloudburstmc.api.block.BlockState getBlock(org.cloudburstmc.api.util.Identifier identifier) -
getBlock
public org.cloudburstmc.api.block.BlockState getBlock(org.cloudburstmc.api.util.Identifier identifier, int meta) -
getBlock
public org.cloudburstmc.api.block.BlockState getBlock(int id, int meta) -
getBlock
public org.cloudburstmc.api.block.BlockState getBlock(int runtimeId) -
getBlock
public org.cloudburstmc.api.block.BlockState getBlock(com.nukkitx.nbt.NbtMap tag) -
getLegacyId
-
getLegacyId
public int getLegacyId(org.cloudburstmc.api.util.Identifier identifier) -
getNameFromLegacyId
public org.cloudburstmc.api.util.Identifier getNameFromLegacyId(int id) -
close
public void close() throws org.cloudburstmc.api.registry.RegistryException- Specified by:
closein interfaceorg.cloudburstmc.api.registry.Registry- Throws:
org.cloudburstmc.api.registry.RegistryException
-
getPaletteTag
public com.nukkitx.nbt.NbtList<com.nukkitx.nbt.NbtMap> getPaletteTag() -
getPropertiesTag
public com.nukkitx.nbt.NbtMap getPropertiesTag() -
getBehavior
public org.cloudburstmc.api.block.behavior.BlockBehavior getBehavior(org.cloudburstmc.api.block.BlockType blockType) -
getBlockStates
public com.google.common.collect.ImmutableList<org.cloudburstmc.api.block.BlockState> getBlockStates()
-