元花

元花

用于数据包和模组的世界生成与战利品工具库。

基础库

一个用于模组和数据包的小型世界生成与战利品工具库

它添加了什么?

Genflower 添加了两个新的结构处理器和一个战利品函数,以帮助加快数据包的开发, 使以前在原版处理器中无法做到、困难或繁琐的事情成为可能。

战利品函数

设置随机药水 genflower:set_random_potion

一个用于酿造台和箱子中药水的药水随机化函数。

  • potions:一个药水->权重映射,可以用以下两种方式之一表示:
    • ID 到权重的映射:{"minecraft:luck": 1}
    • 列表中的对象:[{"data":"minecraft:luck","weight":1}]

使用对象在列表中的表示法时,weight 字段是可选的,默认为 1。

示例 JSON 文件
// data/useyourname/loot_tables/chests/your_loot.json -> /pools[]
{
	"entries": [
		{
			"type": "minecraft:item",
			"functions": [
				{
					"function": "genflower:set_random_potion",
					"potions": {
						"minecraft:long_invisibility": 1,
						"minecraft:invisibility": 5
					}
				}
			],
			"name": "minecraft:potion"
		},
		{
			"type": "minecraft:item",
			"functions": [
				{
					"function": "genflower:set_random_potion",
					"potions": [
						{
							"data": "minecraft:long_invisibility",
							"weight": 1
						},
						{
							"data": "minecraft:invisibility",
							"weight": 5
						}
					]
				}
			],
			"name": "minecraft:splash_potion"
		}
	]
}

结构处理器

方块映射 genflower:block_map

一个方块到方块列表的映射,用于减少结构处理器的冗长程度。

  • block_map:一个用于替换方块的方块到方块列表的映射。
  • probability:方块被替换为新方块的可能性。
    • 范围为 0-1,默认为 1。
示例 JSON 文件
// data/useyourname/worldgen/processor_list/your_processor.json
{
	"processors": [
		{
			"processor_type": "genflower:block_map",
			"block_map": {
				"minecraft:cobweb": ["minecraft:air"],
				"supplementaries:ash": ["minecraft:air"]
			}
		},
		{
			"processor_type": "genflower:block_map",
			"block_map": {
				"minecraft:deepslate_bricks": [
					"minecraft:cobbled_deepslate",
					"minecraft:deepslate_brick_stairs",
					"minecraft:deepslate_brick_slab"
				],
				"minecraft:lantern": ["wilderwild:display_lantern"],
				"minecraft:deepslate_brick_stairs": [
					"minecraft:deepslate_brick_slab"
				],
				"minecraft:mangrove_stairs": [
					"minecraft:mangrove_slab",
					"minecraft:cobweb"
				],
				"minecraft:anvil": [
					"minecraft:chipped_anvil",
					"minecraft:damaged_anvil"
				]
			},
			"probability": 0.25
		}
	]
}

战利品 genflower:loot

一个在世界生成时应用的战利品应用器,用于那些拥有物品栏但不支持 LootTable NBT 标签的方块。

  • loot_table:要应用到指定方块的战利品表
  • blocks:允许注入战利品的方块白名单。
  • slots:该方块通常支持的槽位数量。
  • probability:方块应用战利品表的可能性。
    • 范围为 0-1,默认为 1。
示例 JSON 文件
// data/useyourname/worldgen/processor_list/your_processor.json
{
	"processors": [
		{
			"processor_type": "genflower:loot",
			"loot_table": "useyourname:chests/library_bookshelves",
			"blocks": ["minecraft:chiseled_bookshelf"],
			"slots": 6,
			"probability": 0.8
		},
		{
			"processor_type": "genflower:loot",
			"loot_table": "useyourname:chests/library_brewing_stands",
			"blocks": ["minecraft:brewing_stand"],
			"slots": 3
		}
	]
}