forked from Greymerk/minecraft-roguelike
-
Notifications
You must be signed in to change notification settings - Fork 9
Enchanted Book Loot Items
fnar edited this page Dec 29, 2021
·
1 revision
Represents a loot rule that when used to create an item generates an enchanted book with some complex level rulings.
- {object}
- "ench": integer: Represents the enchantment level (0-30+) to be placed on enchanted books produced by this rule.
- optional
- default 0
- min/max: [0, ?)
- "level": integer: Represents the dungeon layer (1-5). Only used if the "ench" property is not set or set to 0.
- optional
- default 0
- min/max: [0, 4] (follows programming's 0-indexing)
- "ench": integer: Represents the enchantment level (0-30+) to be placed on enchanted books produced by this rule.
{"level": 0, "ench": 0}
This table can be used to determine loosely what enchantment level will be given to a book provided by this rule when the "ench" property is 0 or omitted based on the dungeon layer level specified by the "level" property.
Follows the values here.
In case of dead link, code copied here, but may be outdated:
public static int getLevel(Random rand, int level) {
switch (level) {
case 4:
return 30 + rand.nextInt(10);
case 3:
return 15 + rand.nextInt(15);
case 2:
return 5 + rand.nextInt(15);
case 1:
return 1 + rand.nextInt(10);
case 0:
return 1 + rand.nextInt(5);
default:
return 1;
}
}