mirror of
https://github.com/italicsjenga/valence.git
synced 2024-12-23 14:31:30 +11:00
Add basic enchantment extraction (#93)
* Add basic enchantment extraction * Change source format to individual fields rather than a list Co-authored-by: Terminator <terminator@nonexistent.com>
This commit is contained in:
parent
94cfc41486
commit
838a75d2f9
550
extracted/enchants.json
Normal file
550
extracted/enchants.json
Normal file
|
@ -0,0 +1,550 @@
|
|||
{
|
||||
"enchants": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "protection",
|
||||
"translation_key": "enchantment.minecraft.protection",
|
||||
"min_level": 1,
|
||||
"max_level": 4,
|
||||
"rarity_weight": 10,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "fire_protection",
|
||||
"translation_key": "enchantment.minecraft.fire_protection",
|
||||
"min_level": 1,
|
||||
"max_level": 4,
|
||||
"rarity_weight": 5,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "feather_falling",
|
||||
"translation_key": "enchantment.minecraft.feather_falling",
|
||||
"min_level": 1,
|
||||
"max_level": 4,
|
||||
"rarity_weight": 5,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"name": "blast_protection",
|
||||
"translation_key": "enchantment.minecraft.blast_protection",
|
||||
"min_level": 1,
|
||||
"max_level": 4,
|
||||
"rarity_weight": 2,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"name": "projectile_protection",
|
||||
"translation_key": "enchantment.minecraft.projectile_protection",
|
||||
"min_level": 1,
|
||||
"max_level": 4,
|
||||
"rarity_weight": 5,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"name": "respiration",
|
||||
"translation_key": "enchantment.minecraft.respiration",
|
||||
"min_level": 1,
|
||||
"max_level": 3,
|
||||
"rarity_weight": 2,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"name": "aqua_affinity",
|
||||
"translation_key": "enchantment.minecraft.aqua_affinity",
|
||||
"min_level": 1,
|
||||
"max_level": 1,
|
||||
"rarity_weight": 2,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"name": "thorns",
|
||||
"translation_key": "enchantment.minecraft.thorns",
|
||||
"min_level": 1,
|
||||
"max_level": 3,
|
||||
"rarity_weight": 1,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"name": "depth_strider",
|
||||
"translation_key": "enchantment.minecraft.depth_strider",
|
||||
"min_level": 1,
|
||||
"max_level": 3,
|
||||
"rarity_weight": 2,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"name": "frost_walker",
|
||||
"translation_key": "enchantment.minecraft.frost_walker",
|
||||
"min_level": 1,
|
||||
"max_level": 2,
|
||||
"rarity_weight": 2,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": true,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"name": "binding_curse",
|
||||
"translation_key": "enchantment.minecraft.binding_curse",
|
||||
"min_level": 1,
|
||||
"max_level": 1,
|
||||
"rarity_weight": 1,
|
||||
"cursed": true,
|
||||
"sources": {
|
||||
"treasure": true,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"name": "soul_speed",
|
||||
"translation_key": "enchantment.minecraft.soul_speed",
|
||||
"min_level": 1,
|
||||
"max_level": 3,
|
||||
"rarity_weight": 1,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": true,
|
||||
"enchantment_table": false,
|
||||
"random_selection": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"name": "swift_sneak",
|
||||
"translation_key": "enchantment.minecraft.swift_sneak",
|
||||
"min_level": 1,
|
||||
"max_level": 3,
|
||||
"rarity_weight": 1,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": true,
|
||||
"enchantment_table": false,
|
||||
"random_selection": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 13,
|
||||
"name": "sharpness",
|
||||
"translation_key": "enchantment.minecraft.sharpness",
|
||||
"min_level": 1,
|
||||
"max_level": 5,
|
||||
"rarity_weight": 10,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 14,
|
||||
"name": "smite",
|
||||
"translation_key": "enchantment.minecraft.smite",
|
||||
"min_level": 1,
|
||||
"max_level": 5,
|
||||
"rarity_weight": 5,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 15,
|
||||
"name": "bane_of_arthropods",
|
||||
"translation_key": "enchantment.minecraft.bane_of_arthropods",
|
||||
"min_level": 1,
|
||||
"max_level": 5,
|
||||
"rarity_weight": 5,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 16,
|
||||
"name": "knockback",
|
||||
"translation_key": "enchantment.minecraft.knockback",
|
||||
"min_level": 1,
|
||||
"max_level": 2,
|
||||
"rarity_weight": 5,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 17,
|
||||
"name": "fire_aspect",
|
||||
"translation_key": "enchantment.minecraft.fire_aspect",
|
||||
"min_level": 1,
|
||||
"max_level": 2,
|
||||
"rarity_weight": 2,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 18,
|
||||
"name": "looting",
|
||||
"translation_key": "enchantment.minecraft.looting",
|
||||
"min_level": 1,
|
||||
"max_level": 3,
|
||||
"rarity_weight": 2,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 19,
|
||||
"name": "sweeping",
|
||||
"translation_key": "enchantment.minecraft.sweeping",
|
||||
"min_level": 1,
|
||||
"max_level": 3,
|
||||
"rarity_weight": 2,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 20,
|
||||
"name": "efficiency",
|
||||
"translation_key": "enchantment.minecraft.efficiency",
|
||||
"min_level": 1,
|
||||
"max_level": 5,
|
||||
"rarity_weight": 10,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 21,
|
||||
"name": "silk_touch",
|
||||
"translation_key": "enchantment.minecraft.silk_touch",
|
||||
"min_level": 1,
|
||||
"max_level": 1,
|
||||
"rarity_weight": 1,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 22,
|
||||
"name": "unbreaking",
|
||||
"translation_key": "enchantment.minecraft.unbreaking",
|
||||
"min_level": 1,
|
||||
"max_level": 3,
|
||||
"rarity_weight": 5,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 23,
|
||||
"name": "fortune",
|
||||
"translation_key": "enchantment.minecraft.fortune",
|
||||
"min_level": 1,
|
||||
"max_level": 3,
|
||||
"rarity_weight": 2,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 24,
|
||||
"name": "power",
|
||||
"translation_key": "enchantment.minecraft.power",
|
||||
"min_level": 1,
|
||||
"max_level": 5,
|
||||
"rarity_weight": 10,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 25,
|
||||
"name": "punch",
|
||||
"translation_key": "enchantment.minecraft.punch",
|
||||
"min_level": 1,
|
||||
"max_level": 2,
|
||||
"rarity_weight": 2,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 26,
|
||||
"name": "flame",
|
||||
"translation_key": "enchantment.minecraft.flame",
|
||||
"min_level": 1,
|
||||
"max_level": 1,
|
||||
"rarity_weight": 2,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 27,
|
||||
"name": "infinity",
|
||||
"translation_key": "enchantment.minecraft.infinity",
|
||||
"min_level": 1,
|
||||
"max_level": 1,
|
||||
"rarity_weight": 1,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 28,
|
||||
"name": "luck_of_the_sea",
|
||||
"translation_key": "enchantment.minecraft.luck_of_the_sea",
|
||||
"min_level": 1,
|
||||
"max_level": 3,
|
||||
"rarity_weight": 2,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 29,
|
||||
"name": "lure",
|
||||
"translation_key": "enchantment.minecraft.lure",
|
||||
"min_level": 1,
|
||||
"max_level": 3,
|
||||
"rarity_weight": 2,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 30,
|
||||
"name": "loyalty",
|
||||
"translation_key": "enchantment.minecraft.loyalty",
|
||||
"min_level": 1,
|
||||
"max_level": 3,
|
||||
"rarity_weight": 5,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 31,
|
||||
"name": "impaling",
|
||||
"translation_key": "enchantment.minecraft.impaling",
|
||||
"min_level": 1,
|
||||
"max_level": 5,
|
||||
"rarity_weight": 2,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 32,
|
||||
"name": "riptide",
|
||||
"translation_key": "enchantment.minecraft.riptide",
|
||||
"min_level": 1,
|
||||
"max_level": 3,
|
||||
"rarity_weight": 2,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 33,
|
||||
"name": "channeling",
|
||||
"translation_key": "enchantment.minecraft.channeling",
|
||||
"min_level": 1,
|
||||
"max_level": 1,
|
||||
"rarity_weight": 1,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 34,
|
||||
"name": "multishot",
|
||||
"translation_key": "enchantment.minecraft.multishot",
|
||||
"min_level": 1,
|
||||
"max_level": 1,
|
||||
"rarity_weight": 2,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 35,
|
||||
"name": "quick_charge",
|
||||
"translation_key": "enchantment.minecraft.quick_charge",
|
||||
"min_level": 1,
|
||||
"max_level": 3,
|
||||
"rarity_weight": 5,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 36,
|
||||
"name": "piercing",
|
||||
"translation_key": "enchantment.minecraft.piercing",
|
||||
"min_level": 1,
|
||||
"max_level": 4,
|
||||
"rarity_weight": 10,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": false,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 37,
|
||||
"name": "mending",
|
||||
"translation_key": "enchantment.minecraft.mending",
|
||||
"min_level": 1,
|
||||
"max_level": 1,
|
||||
"rarity_weight": 2,
|
||||
"cursed": false,
|
||||
"sources": {
|
||||
"treasure": true,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 38,
|
||||
"name": "vanishing_curse",
|
||||
"translation_key": "enchantment.minecraft.vanishing_curse",
|
||||
"min_level": 1,
|
||||
"max_level": 1,
|
||||
"rarity_weight": 1,
|
||||
"cursed": true,
|
||||
"sources": {
|
||||
"treasure": true,
|
||||
"enchantment_table": true,
|
||||
"random_selection": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -6,6 +6,7 @@ import dev._00a.valence_extractor.extractors.Blocks;
|
|||
import dev._00a.valence_extractor.extractors.Entities;
|
||||
import dev._00a.valence_extractor.extractors.EntityData;
|
||||
import dev._00a.valence_extractor.extractors.Packets;
|
||||
import dev._00a.valence_extractor.extractors.Enchants;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -40,7 +41,7 @@ public class Main implements ModInitializer {
|
|||
public void onInitialize() {
|
||||
LOGGER.info("Starting extractors...");
|
||||
|
||||
var extractors = new Extractor[]{new Blocks(), new Entities(), new EntityData(), new Packets()};
|
||||
var extractors = new Extractor[]{new Blocks(), new Entities(), new EntityData(), new Packets(), new Enchants()};
|
||||
|
||||
Path outputDirectory;
|
||||
try {
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
package dev._00a.valence_extractor.extractors;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import dev._00a.valence_extractor.Main;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public class Enchants implements Main.Extractor {
|
||||
public Enchants() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String fileName() {
|
||||
return "enchants.json";
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonElement extract() {
|
||||
var topLevelJson = new JsonObject();
|
||||
var enchantsJson = new JsonArray();
|
||||
|
||||
for (var enchant : Registry.ENCHANTMENT) {
|
||||
var enchantJson = new JsonObject();
|
||||
|
||||
enchantJson.addProperty("id", Registry.ENCHANTMENT.getRawId(enchant));
|
||||
enchantJson.addProperty("name", Registry.ENCHANTMENT.getId(enchant).getPath());
|
||||
enchantJson.addProperty("translation_key", enchant.getTranslationKey());
|
||||
|
||||
enchantJson.addProperty("min_level", enchant.getMinLevel());
|
||||
enchantJson.addProperty("max_level", enchant.getMaxLevel());
|
||||
enchantJson.addProperty("rarity_weight", enchant.getRarity().getWeight());
|
||||
enchantJson.addProperty("cursed", enchant.isCursed());
|
||||
|
||||
var enchantmentSources = new JsonObject();
|
||||
enchantmentSources.addProperty("treasure", enchant.isTreasure());
|
||||
enchantmentSources.addProperty("enchantment_table", enchant.isAvailableForEnchantedBookOffer());
|
||||
//All enchants except for 'Soul speed' and 'Swift sneak' are available for random selection and are only obtainable from loot chests.
|
||||
enchantmentSources.addProperty("random_selection", enchant.isAvailableForRandomSelection());
|
||||
|
||||
enchantJson.add("sources", enchantmentSources);
|
||||
|
||||
enchantsJson.add(enchantJson);
|
||||
}
|
||||
|
||||
topLevelJson.add("enchants", enchantsJson);
|
||||
return topLevelJson;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue