Package cn.nukkit.block.customblock
Record Class CustomBlockDefinition
java.lang.Object
java.lang.Record
cn.nukkit.block.customblock.CustomBlockDefinition
@PowerNukkitXOnly
@Since("1.19.31-r1")
public record CustomBlockDefinition(String identifier, CompoundTag nbt)
extends Record
CustomBlockDefinition用于获得发送给客户端的方块行为包数据。
CustomBlockDefinition.Builder
中提供的方法都是控制发送给客户端数据,如果需要控制服务端部分行为,请覆写Block
中的方法。
CustomBlockDefinition is used to get the data of the block behavior_pack sent to the client. The methods provided in CustomBlockDefinition.Builder
control the data sent to the client, if you need to control some of the server-side behavior, please override the methods in Block
.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionCustomBlockDefinition
(String identifier, CompoundTag nbt) Creates an instance of aCustomBlockDefinition
record class. -
Method Summary
Modifier and TypeMethodDescriptionbuilder
(CustomBlock customBlock, Materials materials) builder
(CustomBlock customBlock, Materials materials, BlockCreativeCategory blockCreativeCategory) Builder custom block definition.builder
(CustomBlock customBlock, String texture) builder
(CustomBlock customBlock, String texture, BlockCreativeCategory blockCreativeCategory) final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.Returns the value of theidentifier
record component.nbt()
Returns the value of thenbt
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
CustomBlockDefinition
Creates an instance of aCustomBlockDefinition
record class.- Parameters:
identifier
- the value for theidentifier
record componentnbt
- the value for thenbt
record component
-
-
Method Details
-
builder
-
builder
public static CustomBlockDefinition.Builder builder(CustomBlock customBlock, String texture, BlockCreativeCategory blockCreativeCategory) -
builder
-
builder
public static CustomBlockDefinition.Builder builder(@NotNull CustomBlock customBlock, @NotNull Materials materials, BlockCreativeCategory blockCreativeCategory) Builder custom block definition.- Parameters:
customBlock
- the custom blockmaterials
- the materialsblockCreativeCategory
- 自定义方块在创造栏的大分类
the block creative category- Returns:
- the custom block definition builder.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
identifier
Returns the value of theidentifier
record component.- Returns:
- the value of the
identifier
record component
-
nbt
Returns the value of thenbt
record component.- Returns:
- the value of the
nbt
record component
-