-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added ability to combine enchanted books through assembly
- Loading branch information
1 parent
52786ef
commit 1dd94f1
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
if (feature("Combining enchanted books")) { | ||
var $Registry = Java.loadClass("net.minecraft.core.Registry"); | ||
|
||
$Registry.ENCHANTMENT.entrySet().forEach((enchant) => { | ||
var enchant_id = String(enchant.getKey().location()); | ||
var enchant_max_level = parseInt( | ||
enchant.getValue().getMaxLevel().toFixed(0) | ||
); | ||
let enchant_level = 2; | ||
while (enchant_level <= enchant_max_level) { | ||
addAssembly( | ||
Item.of("minecraft:enchanted_book", 1).enchant( | ||
enchant_id, | ||
enchant_level | ||
), | ||
Item.of("minecraft:enchanted_book", 1) | ||
.enchant(enchant_id, enchant_level - 1) | ||
.strongNBT(), | ||
[ | ||
addFilling( | ||
"stick", | ||
"stick", | ||
"1x create_enchantment_industry:experience" | ||
), | ||
addDeploying( | ||
"stick", | ||
"stick", | ||
Item.of("minecraft:enchanted_book", 1) | ||
.enchant(enchant_id, enchant_level - 1) | ||
.strongNBT() | ||
), | ||
] | ||
); | ||
enchant_level++; | ||
} | ||
}); | ||
} |