| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
extendBehavior(Identifier type,
Function<BlockBehavior,BlockBehaviorDelegate> factory)
Extends current behavior with delegated one provided by the factory.
|
static BlockRegistry |
get() |
BlockBehavior |
getBehavior(Identifier blockType) |
BlockState |
getBlock(Identifier identifier) |
BlockState |
getBlock(Identifier identifier,
int meta) |
BlockState |
getBlock(int runtimeId) |
BlockState |
getBlock(int id,
int meta) |
BlockState |
getBlock(Item item) |
com.google.common.collect.ImmutableList<BlockState> |
getBlockStates() |
int |
getLegacyId(Identifier identifier) |
int |
getLegacyId(String name) |
Identifier |
getNameFromLegacyId(int id) |
com.nukkitx.nbt.NbtList<com.nukkitx.nbt.NbtMap> |
getPaletteTag() |
com.nukkitx.nbt.NbtMap |
getPropertiesTag() |
int |
getRuntimeId(BlockState blockState) |
int |
getRuntimeId(Identifier identifier,
int meta) |
int |
getRuntimeId(int id,
int meta) |
void |
overwriteBehavior(Identifier type,
BlockBehavior behavior)
Overwrites existing or registers new
BlockBehavior instance if absent |
void |
register(Identifier id,
BlockBehavior behavior) |
public static BlockRegistry get()
public void register(Identifier id, BlockBehavior behavior) throws RegistryException
RegistryExceptionpublic void extendBehavior(Identifier type, Function<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 - identifier to register the behavior forfactory - factory providing BlockBehaviorDelegate instanceRegistryException - if there's no behavior registered for the specified typepublic void overwriteBehavior(Identifier type, BlockBehavior behavior)
BlockBehavior instance if absenttype - identifier to register the behavior forbehavior - overwriting behavior instancepublic int getRuntimeId(BlockState blockState)
public int getRuntimeId(Identifier identifier, int meta)
public int getRuntimeId(int id,
int meta)
public BlockState getBlock(Identifier identifier)
public BlockState getBlock(Item item)
public BlockState getBlock(Identifier identifier, int meta)
public BlockState getBlock(int id, int meta)
public BlockState getBlock(int runtimeId)
public int getLegacyId(String name)
public int getLegacyId(Identifier identifier)
public Identifier getNameFromLegacyId(int id)
public void close()
throws RegistryException
close in interface RegistryRegistryExceptionpublic com.nukkitx.nbt.NbtList<com.nukkitx.nbt.NbtMap> getPaletteTag()
public com.nukkitx.nbt.NbtMap getPropertiesTag()
public BlockBehavior getBehavior(Identifier blockType)
public com.google.common.collect.ImmutableList<BlockState> getBlockStates()
Copyright © 2020. All rights reserved.