Zig:注册表
函数
registry.blocks
| Zig |
|---|
| pub fn blocks(allocator: Allocator) core.Error!types.Owned(BlockType)
|
所有方块类型。
registry.items
| Zig |
|---|
| pub fn items(allocator: Allocator) core.Error!types.Owned(ItemType)
|
所有物品,每种以它完整的名字出现一次。
registry.entities
| Zig |
|---|
| pub fn entities(allocator: Allocator) core.Error!types.Owned(EntityType)
|
关卡知道的所有实体。
registry.commands
| Zig |
|---|
| pub fn commands(allocator: Allocator) core.Error!types.Owned(CommandType)
|
引擎注册表里的每一条命令,不论是哪个 mod 注册的。
声明
registry.EntityType.json_keys
| Zig |
|---|
| pub const json_keys = .{ .type_id = "type" };
|
registry.EntityType
| Zig |
|---|
| pub const EntityType = struct {
name: []const u8 = "",
spawn_egg: bool = false,
summonable: bool = false,
experimental: bool = false,
type_id: i64 = 0,
// ...
};
|
关卡知道的一种实体。
registry.EntityType.isMob
| Zig |
|---|
| pub fn isMob(self: EntityType) bool
|
registry.EntityType.isMonster
| Zig |
|---|
| pub fn isMonster(self: EntityType) bool
|
registry.EntityType.isAnimal
| Zig |
|---|
| pub fn isAnimal(self: EntityType) bool
|
陆地动物:有动物位,没有水生动物位。
registry.EntityType.isWaterAnimal
| Zig |
|---|
| pub fn isWaterAnimal(self: EntityType) bool
|
registry.BlockType
| Zig |
|---|
| pub const BlockType = struct {
name: []const u8 = "",
category: i32 = 0,
solid: bool = false,
vanilla: bool = false,
container: bool = false,
signal: bool = false,
fence: bool = false,
rail: bool = false,
slab: bool = false,
wall: bool = false,
crop: bool = false,
entity: bool = false,
destroy: f64 = 0,
resistance: f64 = 0,
light: i32 = 0,
description: []const u8 = "",
// ...
};
|
一种方块,按它的默认状态读取。
registry.ItemType
| Zig |
|---|
| pub const ItemType = struct {
name: []const u8 = "",
rarity: i32 = 0,
stack: i32 = 0,
category: i32 = 0,
hidden: bool = false,
// ...
};
|
一种物品。
registry.CommandType
| Zig |
|---|
| pub const CommandType = struct {
name: []const u8 = "",
description: []const u8 = "",
permission: i32 = 0,
flags: i32 = 0,
hidden: bool = false,
aliases: []const []const u8 = &.{},
// ...
};
|
引擎注册表里的一条命令。