藏宝袋类型

以下内容是粗略翻译加原文对照,希望对你们有帮助。

藏宝袋类型是宝藏的变体。它们是由JSON文件定义的。您可以在任意数量的数据包中使用任意数量的袋子类型。这定义了藏宝袋里的内容。

袋子类型的文件应该放在data/*/treasurebags_types中,其中*是数据包的命名空间。无需进一步操作即可注册行李类型,只需确保它们位于正确的文件夹中即可。您也不需要为此重新启动游戏。您可以重新加载您的世界,也可以只使用/reload命令。

用开放式加载mod进行添加方便很多。

原文:

Bag types are treasure bag variants. They are defined by JSON files. You can any number of bag types across any number of data packs. This defines the properties of the bag.

Bag type files should be placed in data/*/treasurebags_types, where * is your data pack's namespace. No further action is needed to register bag types, just make sure they are in the right folder. You also do not need to restart your game for this. You can either reload your world, or just use the /reload command.

藏宝袋类型ID

在某些情况下,您需要知道袋子类型ID,例如在编写战利品表以放置袋子时。通常,如果您有一个位于data/namespace/treasurebags_types/file.json的文件,那么ID将是namespace:file。您可以在其他文件夹中组织袋子类型,这些文件夹将成为ID的一部分(即名称空间:文件夹/文件)。为了简单起见,只需将所有内容放在一个文件夹中即可。

原文:

You will need to know the bag type ID in some cases, such as when writing loot tables to drop bags. In general, if you have a file located at data/namespace/treasurebags_types/file.json, the ID would be namespace:file. You could organize bag types in additional folders, which would become part of the ID (i.e. namespace:folder/file). For simplicity, just put everything in one folder.

JSON格式

group(string)-行李类型的组标识符。可以是任何字符串。mod的配置文件可以很容易地禁用整个组。所有内置的袋子类型都在“默认”和“示例”组中,因此请避免将它们分配给您的袋子。默认情况下,“示例”组处于禁用状态。

*displayName(文本组件对象)-物品的名称(通常为{“text”:“My Bag's name”})

*lootTable(string)-袋子使用的战利品表的ID

*rarity(字符串)-袋子的稀有性,会影响掉落几率和名称颜色(字符串属性,通常为:普通、不常见、稀有、史诗)

*dropsFromGroups(array)-袋子可能从中掉落的“实体组类”(和平、敌对、boss、玩家)列表

*bagColor(string)-袋子的主要颜色(参见颜色注释)

*bagOverlayColor(string)-袋子上图案的颜色(参见颜色注释)

*bagStringColor(string)-袋子上绑绳的颜色(参见颜色注释)

原文:

  • group (string) - A group identifier for the bag type. Can be any string. The mod's config file allows entire groups to be easily disabled. All built-in bag types are in the "default" and "example" groups, so avoid assigning those to your bags. The "example" group is disabled by default.

  • displayName (text component object) - The name of the item (typically {"text": "My Bag's Name"})

  • lootTable (string) - The ID of the loot table the bag uses

  • rarity (string) - The rarity of the bag, which affects drop chances and name color (string property, typically: common, uncommon, rare, epic)

  • dropsFromGroups (array) - List of "entity groups" (peaceful, hostile, boss, player) the bag may drop from

  • bagColor (string) - The main color of the bag (see color notes)

  • bagOverlayColor (string) - The color of the design on the bag (see color notes)

  • bagStringColor (string) - The color of the drawstring on the bag (see color notes)

颜色

颜色类型可以是十六进制代码或CSS颜色名称。对于十六进制代码,“#”符号是可选的。对于CSS颜色名称,只能使用字母,不使用空格,不区分大小写(例如:“aliceblue”)。这种行为在所有的mod中都是通用的(1.13.2+)。

原文:

The color properties can be hex codes or CSS color names. For hex codes, the "#" symbol is optional. For CSS color names, use only letters, no spaces, case-insensitive (example: "aliceblue"). This behavior is universal across all my mods (1.13.2+).

制作藏宝袋

介绍

Treasure Bags添加了一种新的构成类型和两种新的配方类型(规则的与无规则的),使Treasure Pack可以用于配方中。这些配方扩展了原版规则的与无规则的配方,因此它们的格式非常相似。JEI可以识别它们,与此同时JEI还可以区分不同的袋子类型。

原文:

Treasure Bags add a new ingredient type and two new recipe types (shaped and shapeless) to allow treasure bags to be used in recipes. These recipes extend the vanilla shaped and shapeless recipes, so their format is very similar and JEI can understand them. JEI can also tell different bag types apart.

Creating recipes for/using treasure bags is not required. It is an option you can use if you want to.

相匹配的藏宝袋类型

不幸的是,藏宝袋类型是在构成和配方之后注册的,因此无法验证袋子类型是否正确。请仔细检查您的拼写,因为您不会在日志文件中看到警告。无效类型会产生无效的配方,或者产生无效藏宝袋的配方(这些不会导致游戏崩溃,只是不起作用)。

原文:

Unfortunately, bag types are registered after ingredients and recipes, so these cannot verify that bag types are correct. Please double-check your spelling, as you will not see warnings in the log file. Invalid types will produce non-functioning recipes, or recipes that create invalid bags (these will not crash your game, they just won't work).

构成

藏宝袋的成分是类型treasurebags:bag,有一个属性bag_type,即藏宝袋类型ID。完整的对象看起来像这样:

{
    "type": "treasurebags:bag", 
   "bag_type": "treasurebags:default"
}


配方

这两种配方类型都扩展了原版规则与无规则的配方。唯一的变化是在result(当然还有type)中添加了bag_type属性。

请注意,如果生成的物品不是藏宝袋,这些配方将在日志中发出警告

规则的

{
    "type": "treasurebags:shaped_bag",
    "pattern": [
        "#",
        "/"
    ],
    "key": {
        "#": {
            "type": "treasurebags:bag",
            "bag_type": "treasurebags:default"
        },
        "/": {
            "tag": "forge:ingots/gold"
        }
    },
    "result": {
        "item": "treasurebags:treasure_bag",
        "bag_type": "treasurebags:test"
    }
}

无规则的:

{
    "type": "treasurebags:shapeless_bag",
    "ingredients": [
        {
            "type": "treasurebags:bag",
            "bag_type": "treasurebags:test"
        },
        {
            "item": "minecraft:clay_ball"
        }
    ],
    "result": {
        "item": "treasurebags:treasure_bag",
        "bag_type": "treasurebags:default"
    }
}

藏宝袋掉落

稀有性和实体组

在1.3.0版本及更高版本中,所有袋子都将根据稀有程度从不同类型的实体(生物)掉落。每组都有一个战利品表,您可以覆盖它来自定义掉落率。

实体组掉落可以从这下面参考。

原文:

In version 1.3.0 and higher, all bags will drop from different types of entities (mobs) based on their rarity. Each group has a loot table, which you can override to customize drop rates.

Entity group loot tables are found here: 1.16.x

战利品机制

为了更好的控制掉落,有一个战利品功能,可以设置袋子类型(因为所有袋子都是一个物品)。您必须使用此功能才能获得正确的藏宝袋掉落类型。函数名为treasurebags:set_bag_type,它有一个属性type,即袋子类型ID。请参阅下面的示例。

原文:

For more control, there is a loot function which will set the bag type (as all bags are a single item). You must use this function to get the correct bag type. The function name is treasurebags:set_bag_type and it has one property, type, which is the bag type ID. See the example below.

例子

这个特殊的文件(即战利品表)有一个奖励池,有10%的基础掉落率,每个玩家的掠夺级别增加2.5%的额外掉落率。如果你愿意,当然可以省略这些条件。你可能也希望大多数袋子的掉落率低得多,可能是1~5%。

请注意,如果您在一个奖励池中有多个宝藏袋条目,则需要为每个条目包含一个唯一值的entryName属性。只要您有同一项目的多个条目,就需要这样做。

对于袋子类型,格式应该像是your_namespace:bag_type。在本例中,袋子类型文件位于data/schaos_root/trasurebags/bag_types/bat.json,将其转换为chaos_root:bat的藏宝袋类型ID。

原文:

This particular file (which is the bat loot table) has a single pool with one entry, which has a 10% drop rate with a 2.5% bonus per looting level, as well as requiring a player kill. You can of course omit these conditions if you like. You would probably want a much lower drop rate for most bags as well, maybe 1~5%.

Note that if you have more than one treasure bag entry in a pool, you need to include the entryName property with a unique value for each entry. This is needed anytime you have multiple entries of the same item.

For the bag type, this should look like your_namespace:bag_type. In this example, the bag type file is located at data/chaos_loot/treasurebags/bag_types/bat.json, which translates to a bag type ID of chaos_loot:bat.

Converting JSON file name to bag type ID:
data/namespace/treasurebags/bag_types/file.json => namespace:file

{
    "pools": [
        {
            "name": "treasure_bags",
            "rolls": 1,
            "entries": [
                {
                    "entryName": "bat_bag",
                    "type": "item",
                    "name": "treasurebags:treasure_bag",
                    "weight": 1,
                    "functions": [
                        {
                            "function": "treasurebags:set_bag_type",
                            "type": "chaos_loot:bat"
                        }
                    ]
                }
            ],
            "conditions": [
                {
                    "condition": "killed_by_player"
                },
                {
                    "condition": "random_chance_with_looting",
                    "chance": 0.1,
                    "looting_multiplier": 0.025
                }
            ]
        }
    ]
}