-
-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
796341b
commit 3884181
Showing
10 changed files
with
219 additions
and
41 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 @@ | ||
["acacia_boat","acacia_chest_boat","allay","area_effect_cloud","armadillo","armor_stand","arrow","axolotl","bamboo_chest_raft","bamboo_raft","bat","bee","birch_boat","birch_chest_boat","blaze","block_display","bogged","breeze","breeze_wind_charge","camel","cat","cave_spider","cherry_boat","cherry_chest_boat","chest_minecart","chicken","cod","command_block_minecart","cow","creaking","creaking_transient","creeper","dark_oak_boat","dark_oak_chest_boat","dolphin","donkey","dragon_fireball","drowned","egg","elder_guardian","enderman","endermite","ender_dragon","ender_pearl","end_crystal","evoker","evoker_fangs","experience_bottle","experience_orb","eye_of_ender","falling_block","fireball","firework_rocket","fox","frog","furnace_minecart","ghast","giant","glow_item_frame","glow_squid","goat","guardian","hoglin","hopper_minecart","horse","husk","illusioner","interaction","iron_golem","item","item_display","item_frame","jungle_boat","jungle_chest_boat","leash_knot","lightning_bolt","llama","llama_spit","magma_cube","mangrove_boat","mangrove_chest_boat","marker","minecart","mooshroom","mule","oak_boat","oak_chest_boat","ocelot","ominous_item_spawner","painting","pale_oak_boat","pale_oak_chest_boat","panda","parrot","phantom","pig","piglin","piglin_brute","pillager","polar_bear","potion","pufferfish","rabbit","ravager","salmon","sheep","shulker","shulker_bullet","silverfish","skeleton","skeleton_horse","slime","small_fireball","sniffer","snowball","snow_golem","spawner_minecart","spectral_arrow","spider","spruce_boat","spruce_chest_boat","squid","stray","strider","tadpole","text_display","tnt","tnt_minecart","trader_llama","trident","tropical_fish","turtle","vex","villager","vindicator","wandering_trader","warden","wind_charge","witch","wither","wither_skeleton","wither_skull","wolf","zoglin","zombie","zombie_horse","zombie_villager","zombified_piglin","player","fishing_bobber"] |
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
25 changes: 25 additions & 0 deletions
25
extractor/src/main/kotlin/de/snowii/extractor/extractors/Entities.kt
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,25 @@ | ||
package de.snowii.extractor.extractors | ||
|
||
import com.google.gson.JsonArray | ||
import com.google.gson.JsonElement | ||
import de.snowii.extractor.Extractor | ||
import net.minecraft.registry.Registries | ||
import net.minecraft.server.MinecraftServer | ||
|
||
|
||
class Entities : Extractor.Extractor { | ||
override fun fileName(): String { | ||
return "entities.json" | ||
} | ||
|
||
override fun extract(server: MinecraftServer): JsonElement { | ||
val entitiesJson = JsonArray() | ||
for (entity in Registries.ENTITY_TYPE) { | ||
entitiesJson.add( | ||
Registries.ENTITY_TYPE.getId(entity)!!.path, | ||
) | ||
} | ||
|
||
return entitiesJson | ||
} | ||
} |
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,19 @@ | ||
use std::{collections::HashMap, sync::LazyLock}; | ||
|
||
const ENTITIES_JSON: &str = include_str!("../../../assets/entities.json"); | ||
|
||
pub static ENTITIES: LazyLock<Vec<String>> = LazyLock::new(|| { | ||
serde_json::from_str(ENTITIES_JSON).expect("Could not parse entity.json registry.") | ||
}); | ||
|
||
pub static ENTITIES_BY_ID: LazyLock<HashMap<String, u16>> = LazyLock::new(|| { | ||
let mut map = HashMap::new(); | ||
for (i, entity_name) in ENTITIES.iter().enumerate() { | ||
map.insert(entity_name.clone(), i as u16); | ||
} | ||
map | ||
}); | ||
|
||
pub fn get_entity_id(name: &str) -> Option<&u16> { | ||
ENTITIES_BY_ID.get(&name.replace("minecraft:", "")) | ||
} |
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 @@ | ||
pub mod entity_registry; |
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
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
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
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
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