跳至主要内容

什麼是寶藏檔案?

寶藏檔案確定 BetterStructures 箱子的戰利品表。它們通常被分配給[生成器](../Better Structures/creating_generators.md#treasurefilename),但也可以在[單個建筑配置](../Better Structures/creating_structures.md#treasurefile)級別設定。

這些戰利品表非常強大,但需要了解一些基本的統計概念。

在這裡閱讀這些概念,頁面的其餘部分假設你已經理解了它們!

加權機率

加權機率通過給每個物品分配權重來解決從潛在無限列表中選擇物品的問題。

高斯分佈

高斯分佈是一個鐘形的數學函數。

高斯分佈用於隨機化箱子中出現的物品數量。你只需要關注兩個設定:均值和標準差。

均值

mean 設定高斯曲線的中心。如果你希望箱子通常有5個物品,將均值設為5。

標準差

標準差決定數字可以變化多少。小(1):4-6個物品。中(2):3-7個。大(3+):2-8+個。

預設均值為4,預設標準差為3。


實現細節

系統保證箱子中至少出現一個物品。

系統保證箱子中至少出現一個物品。

物品被放置在箱子內的隨機槽位中。

物品被放置在箱子內的隨機槽位中。

如果材料不存在,該物品將被靜默跳過。無效附魔會在控制台顯示警告。

如果材料不存在,該物品將被靜默跳過。無效附魔會在控制台顯示警告。


特殊格式

特殊格式

isEnabled: true
mean: 4.0
standardDeviation: 3.0
vanillaTreasure: BURIED_TREASURE
items:
common:
weight: 60
items:
- amount: 1-1
material: STONE_PICKAXE
procedurallyGenerateEnchantments: true
weight: 1.0
- amount: 1-1
material: STONE_SHOVEL
procedurallyGenerateEnchantments: true
weight: 1.0
rare:
weight: 30
items:
- amount: 1-1
material: ANVIL
weight: 6.0
- amount: 1-6
material: BEETROOT
weight: 6.0
epic:
weight: 10
items:
- amount: 2-10
material: DIAMOND
weight: 1.0
- amount: 1-1
material: DIAMOND_AXE
weight: 6.0
procedurallyGeneratedItemSettings:
golden_sword:
bane_of_arthropods:
minlevel: 1
maxlevel: 5
chance: 0.2
looting:
minlevel: 1
maxlevel: 3
chance: 0.2

isEnabled

KeyValuesDefault
isEnabledBooleantrue

mean

KeyValuesDefault
meanDouble4

standardDeviation

KeyValuesDefault
standardDeviationDouble3

vanillaTreasure

KeyValuesDefault
vanillaTreasureStringnone

設定一個可選的原版 Minecraft 戰利品表,除自訂戰利品外還會使用。


items

由於許多選項可以由管理員設定,這裡變得有點複雜。

items:
common:
weight: 60
items:
- amount: 1-1
material: STONE_PICKAXE
procedurallyGenerateEnchantments: true
weight: 1.0
- amount: 1-1
material: STONE_SHOVEL
procedurallyGenerateEnchantments: true
weight: 1.0
rare:
weight: 30
items:
- amount: 1-1
material: ANVIL
weight: 6.0
- amount: 1-6
material: BEETROOT
weight: 6.0

rarities

稀有度沒有固定名稱。你可以自由添加、刪除和自訂。


rarity items

KeyValuesDefault
amountmin-max Integervariable
materialMaterialvariable
procedurallyGenerateEnchantmentsBooleanvariable
weightDoublevariable

amount

設定掉落數量。可以用範圍 amount: MIN-MAX 或固定值 amount: 值 表示。

material

使用 Spigot API 名稱設定材料。


Special case - serialized

使用 lootify 指令時,serialized 設定會自動生成。不應手動生成。


mmoitem

從 MMOItems 外掛設定自訂物品。

- amount: 1-1
mmoitem: SWORD@Excalibur
weight: 1.0

info

用於添加備註的可選欄位。外掛完全忽略。

- amount: 1-1
material: DIAMOND_SWORD
weight: 1.0
info: "Rare drop for completing the dungeon"

weight

設定加權機率的權重。


procedurallyGenerateEnchantments

設定物品是否應基於 procedurallyGeneratedItemSettings 程序化生成。

procedurallyGeneratedItemSettings

procedurallyGeneratedItemSettings:
golden_sword:
bane_of_arthropods:
minlevel: 1
maxlevel: 5
chance: 0.2
looting:
minlevel: 1
maxlevel: 3
chance: 0.2

此檔案列出材料類型、附魔、最小/最大等級和機率。

KeyValuesDefault
minlevelIntegervariable
maxlevelIntegervariable
chanceChancevariable

minlevel

設定最小附魔等級。


maxlevel

設定最大附魔等級。


chance

將附魔機率設定為0.0(從不)到1.0(總是)之間的小數值。例如:0.2 = 20%。


故障排除

物品不出現在箱子中

  • 驗證寶藏檔案有isEnabled: true
  • 檢查控制台是否有關於無效材料或物品的警告
  • 如果使用自訂物品,確保MMOItems已安裝
  • 材料必須使用精確的Spigot API名稱

附魔未被應用

  • 在物品上設定procedurallyGenerateEnchantments: true
  • 驗證附魔名稱與Minecraft的命名空間鍵匹配
  • 檢查最小/最大等級是否在該附魔的有效範圍內
  • 記住chance值是機率(0.2 = 20%),不是保證

自訂外掛附魔不起作用

只有明確支援BetterStructures整合的自訂附魔才會起作用。請向附魔外掛作者諮詢相容性。無效的附魔會在控制台顯示警告。

出現空箱子

由於系統保證至少一個物品,這不應該發生。如果你看到空箱子,請驗證:

  • 箱子是由BetterStructures填充的(不是其他外掛)
  • 你的寶藏檔案中的所有物品都是有效的(檢查控制台警告)
  • 寶藏檔案確實被載入了(檢查啟動日誌)