66import dev .xpple .seedmapper .SeedMapper ;
77import dev .xpple .seedmapper .feature .StructureChecks ;
88import dev .xpple .seedmapper .util .WorldIdentifier ;
9+ import net .minecraft .network .chat .Component ;
910import net .minecraft .resources .ResourceLocation ;
1011
1112import java .lang .foreign .Arena ;
1213import java .lang .foreign .MemorySegment ;
1314import java .util .Arrays ;
15+ import java .util .HashMap ;
1416import java .util .Map ;
1517import java .util .stream .Collectors ;
1618import java .util .stream .IntStream ;
1719
1820public enum MapFeature {
19- DESERT_PYRAMID ("desert_pyramid" , Cubiomes .Desert_Pyramid (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_3 (), "cubiomes_viewer_icons" , 19 , 20 ),
20- JUNGLE_PYRAMID ("jungle_pyramid" , Cubiomes .Jungle_Pyramid (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_3 (), "cubiomes_viewer_icons" , 19 , 20 ),
21- SWAMP_HUT ("swamp_hut" , Cubiomes .Swamp_Hut (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_4 (), "cubiomes_viewer_icons" , 20 , 20 ),
22- STRONGHOLD ("stronghold" , -1 , Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_B1_8 (), "cubiomes_viewer_icons" , 19 , 20 ),
23- IGLOO ("igloo" , Cubiomes .Igloo (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_9 (), "cubiomes_viewer_icons" , 20 , 20 ) {
21+ DESERT_PYRAMID ("desert_pyramid" , Cubiomes .Desert_Pyramid (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_3 (), "Desert Pyramid" , " cubiomes_viewer_icons" , 19 , 20 ),
22+ JUNGLE_PYRAMID ("jungle_pyramid" , Cubiomes .Jungle_Pyramid (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_3 (), "Jungle Pyramid" , " cubiomes_viewer_icons" , 19 , 20 ),
23+ SWAMP_HUT ("swamp_hut" , Cubiomes .Swamp_Hut (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_4 (), "Swamp Hut" , " cubiomes_viewer_icons" , 20 , 20 ),
24+ STRONGHOLD ("stronghold" , -1 , Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_B1_8 (), "Stronghold" , " cubiomes_viewer_icons" , 19 , 20 ),
25+ IGLOO ("igloo" , Cubiomes .Igloo (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_9 (), "Igloo" , " cubiomes_viewer_icons" , 20 , 20 ) {
2426 private static final Texture IGLOO_BASEMENT_TEXTURE = new Texture ("igloo_basement" , "cubiomes_viewer_icons" , 20 , 20 );
2527 @ Override
2628 public Texture getVariantTexture (WorldIdentifier identifier , int posX , int posZ , int biome ) {
@@ -34,7 +36,7 @@ public Texture getVariantTexture(WorldIdentifier identifier, int posX, int posZ,
3436 }
3537 }
3638 },
37- VILLAGE ("village" , Cubiomes .Village (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_B1_8 (), "cubiomes_viewer_icons" , 19 , 20 ) {
39+ VILLAGE ("village" , Cubiomes .Village (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_B1_8 (), "Village" , " cubiomes_viewer_icons" , 19 , 20 ) {
3840 private static final Texture ZOMBIE_VILLAGE_TEXTURE = new Texture ("zombie" , "cubiomes_viewer_icons" , 19 , 20 );
3941 @ Override
4042 public Texture getVariantTexture (WorldIdentifier identifier , int posX , int posZ , int biome ) {
@@ -48,12 +50,12 @@ public Texture getVariantTexture(WorldIdentifier identifier, int posX, int posZ,
4850 }
4951 }
5052 },
51- OCEAN_RUIN ("ocean_ruin" , Cubiomes .Ocean_Ruin (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_13 (), "cubiomes_viewer_icons" , 19 , 19 ),
52- SHIPWRECK ("shipwreck" , Cubiomes .Shipwreck (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_13 (), "cubiomes_viewer_icons" , 19 , 19 ),
53- MONUMENT ("monument" , Cubiomes .Monument (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_8 (), "cubiomes_viewer_icons" , 20 , 20 ),
54- MANSION ("mansion" , Cubiomes .Mansion (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_11 (), "cubiomes_viewer_icons" , 20 , 20 ),
55- OUTPOST ("pillager_outpost" , Cubiomes .Outpost (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_14 (), "cubiomes_viewer_icons" , 19 , 20 ),
56- RUINED_PORTAL ("ruined_portal" , Cubiomes .Ruined_Portal (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_16_1 (), "cubiomes_viewer_icons" , 20 , 20 ) {
53+ OCEAN_RUIN ("ocean_ruin" , Cubiomes .Ocean_Ruin (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_13 (), "Ocean Ruin" , " cubiomes_viewer_icons" , 19 , 19 ),
54+ SHIPWRECK ("shipwreck" , Cubiomes .Shipwreck (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_13 (), "Shipwreck" , " cubiomes_viewer_icons" , 19 , 19 ),
55+ MONUMENT ("monument" , Cubiomes .Monument (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_8 (), "Ocean Monument" , " cubiomes_viewer_icons" , 20 , 20 ),
56+ MANSION ("mansion" , Cubiomes .Mansion (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_11 (), "Woodland Mansion" , " cubiomes_viewer_icons" , 20 , 20 ),
57+ OUTPOST ("pillager_outpost" , Cubiomes .Outpost (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_14 (), "Pillager Outpost" , " cubiomes_viewer_icons" , 19 , 20 ),
58+ RUINED_PORTAL ("ruined_portal" , Cubiomes .Ruined_Portal (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_16_1 (), "Ruined Portal" , " cubiomes_viewer_icons" , 20 , 20 ) {
5759 private static final Texture RUINED_PORTAL_GIANT_TEXTURE = new Texture ("portal_giant" , "cubiomes_viewer_icons" , 20 , 20 );
5860 @ Override
5961 public Texture getVariantTexture (WorldIdentifier identifier , int posX , int posZ , int biome ) {
@@ -67,23 +69,23 @@ public Texture getVariantTexture(WorldIdentifier identifier, int posX, int posZ,
6769 }
6870 }
6971 },
70- RUINED_PORTAL_N ("ruined_portal_n" , Cubiomes .Ruined_Portal_N (), Cubiomes .DIM_NETHER (), Cubiomes .MC_1_16_1 (), "cubiomes_viewer_icons" , 20 , 20 ) {
72+ RUINED_PORTAL_N ("ruined_portal_n" , Cubiomes .Ruined_Portal_N (), Cubiomes .DIM_NETHER (), Cubiomes .MC_1_16_1 (), "Ruined Portal (Nether)" , " cubiomes_viewer_icons" , 20 , 20 ) {
7173 @ Override
7274 public Texture getVariantTexture (WorldIdentifier identifier , int posX , int posZ , int biome ) {
7375 return RUINED_PORTAL .getVariantTexture (identifier , posX , posZ , biome );
7476 }
7577 },
76- ANCIENT_CITY ("ancient_city" , Cubiomes .Ancient_City (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_19_2 (), "cubiomes_viewer_icons" , 20 , 20 ),
77- TREASURE ("buried_treasure" , Cubiomes .Treasure (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_13 (), "cubiomes_viewer_icons" , 19 , 19 ),
78- MINESHAFT ("mineshaft" , Cubiomes .Mineshaft (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_B1_8 (), "cubiomes_viewer_icons" , 20 , 19 ),
79- DESERT_WELL ("desert_well" , Cubiomes .Desert_Well (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_13 (), "cubiomes_viewer_icons" , 20 , 20 ),
80- GEODE ("geode" , Cubiomes .Geode (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_17 (), "cubiomes_viewer_icons" , 20 , 20 ),
81- COPPER_ORE_VEIN ("copper_ore_vein" , -1 , Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_18 (), "feature_icons" , 20 , 20 ),
82- IRON_ORE_VEIN ("iron_ore_vein" , -1 , Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_18 (), "feature_icons" , 20 , 20 ),
83- CANYON ("canyon" , -1 , Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_13 (), "feature_icons" , 20 , 20 ),
84- FORTRESS ("fortress" , Cubiomes .Fortress (), Cubiomes .DIM_NETHER (), Cubiomes .MC_1_0 (), "cubiomes_viewer_icons" , 20 , 20 ),
85- BASTION ("bastion_remnant" , Cubiomes .Bastion (), Cubiomes .DIM_NETHER (), Cubiomes .MC_1_16_1 (), "cubiomes_viewer_icons" , 20 , 20 ),
86- END_CITY ("end_city" , Cubiomes .End_City (), Cubiomes .DIM_END (), Cubiomes .MC_1_9 (), "cubiomes_viewer_icons" , 20 , 20 ) {
78+ ANCIENT_CITY ("ancient_city" , Cubiomes .Ancient_City (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_19_2 (), "Ancient City" , " cubiomes_viewer_icons" , 20 , 20 ),
79+ TREASURE ("buried_treasure" , Cubiomes .Treasure (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_13 (), "Buried Treasure" , " cubiomes_viewer_icons" , 19 , 19 ),
80+ MINESHAFT ("mineshaft" , Cubiomes .Mineshaft (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_B1_8 (), "Mineshaft" , " cubiomes_viewer_icons" , 20 , 19 ),
81+ DESERT_WELL ("desert_well" , Cubiomes .Desert_Well (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_13 (), "Desert Well" , " cubiomes_viewer_icons" , 20 , 20 ),
82+ GEODE ("geode" , Cubiomes .Geode (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_17 (), "Geode" , " cubiomes_viewer_icons" , 20 , 20 ),
83+ COPPER_ORE_VEIN ("copper_ore_vein" , -1 , Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_18 (), "Copper Ore Vein" , " feature_icons" , 20 , 20 ),
84+ IRON_ORE_VEIN ("iron_ore_vein" , -1 , Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_18 (), "Iron Ore Vein" , " feature_icons" , 20 , 20 ),
85+ CANYON ("canyon" , -1 , Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_13 (), "Canyon" , " feature_icons" , 20 , 20 ),
86+ FORTRESS ("fortress" , Cubiomes .Fortress (), Cubiomes .DIM_NETHER (), Cubiomes .MC_1_0 (), "Nether Fortress" , " cubiomes_viewer_icons" , 20 , 20 ),
87+ BASTION ("bastion_remnant" , Cubiomes .Bastion (), Cubiomes .DIM_NETHER (), Cubiomes .MC_1_16_1 (), "Bastion Remnant" , " cubiomes_viewer_icons" , 20 , 20 ),
88+ END_CITY ("end_city" , Cubiomes .End_City (), Cubiomes .DIM_END (), Cubiomes .MC_1_9 (), "End City" , " cubiomes_viewer_icons" , 20 , 20 ) {
8789 private static final Texture END_CITY_SHIP_TEXTURE = new Texture ("elytra" , "cubiomes_viewer_icons" , 20 , 20 );
8890 @ Override
8991 public Texture getVariantTexture (WorldIdentifier identifier , int posX , int posZ , int biome ) {
@@ -100,21 +102,28 @@ public Texture getVariantTexture(WorldIdentifier identifier, int posX, int posZ,
100102 }
101103 }
102104 },
103- END_GATEWAY ("end_gateway" , Cubiomes .End_Gateway (), Cubiomes .DIM_END (), Cubiomes .MC_1_13 (), "cubiomes_viewer_icons" , 20 , 20 ),
104- TRAIL_RUINS ("trail_ruins" , Cubiomes .Trail_Ruins (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_20 (), "cubiomes_viewer_icons" , 20 , 20 ),
105- TRIAL_CHAMBERS ("trial_chambers" , Cubiomes .Trial_Chambers (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_21_1 (), "cubiomes_viewer_icons" , 20 , 20 ),
106- SLIME_CHUNK ("slime_chunk" , -1 , Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_B1_7 (), "feature_icons" , 20 , 20 ),
107- WORLD_SPAWN ("world_spawn" , -1 , Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_B1_7 (), "cubiomes_viewer_icons" , 20 , 20 ),
108- WAYPOINT ("waypoint" , -1 , Cubiomes .DIM_UNDEF (), Cubiomes .MC_B1_7 (), "feature_icons" , 20 , 20 ),
105+ END_GATEWAY ("end_gateway" , Cubiomes .End_Gateway (), Cubiomes .DIM_END (), Cubiomes .MC_1_13 (), "End Gateway" , " cubiomes_viewer_icons" , 20 , 20 ),
106+ TRAIL_RUINS ("trail_ruins" , Cubiomes .Trail_Ruins (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_20 (), "Trail Ruins" , " cubiomes_viewer_icons" , 20 , 20 ),
107+ TRIAL_CHAMBERS ("trial_chambers" , Cubiomes .Trial_Chambers (), Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_1_21_1 (), "Trial Chambers" , " cubiomes_viewer_icons" , 20 , 20 ),
108+ SLIME_CHUNK ("slime_chunk" , -1 , Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_B1_7 (), "Slime Chunk" , " feature_icons" , 20 , 20 ),
109+ WORLD_SPAWN ("world_spawn" , -1 , Cubiomes .DIM_OVERWORLD (), Cubiomes .MC_B1_7 (), "World Spawn" , " cubiomes_viewer_icons" , 20 , 20 ),
110+ WAYPOINT ("waypoint" , -1 , Cubiomes .DIM_UNDEF (), Cubiomes .MC_B1_7 (), "Waypoint" , " feature_icons" , 20 , 20 ),
109111 ;
110112
111- public static final Map <String , MapFeature > BY_NAME = Arrays .stream (values ())
112- .collect (Collectors .toUnmodifiableMap (MapFeature ::getName , f -> f ));
113+ public static final Map <String , MapFeature > BY_NAME ;
114+ static {
115+ Map <String , MapFeature > map = Arrays .stream (values ())
116+ .collect (Collectors .toMap (MapFeature ::getName , f -> f , (left , right ) -> left , HashMap ::new ));
117+ map .put ("end_city_ship" , END_CITY );
118+ BY_NAME = Map .copyOf (map );
119+ }
113120
114121 private final String name ;
115122 private final int structureId ;
116123 private final int dimension ;
117124 private final int availableSince ;
125+ private final Component displayName ;
126+ private final String translationKey ;
118127 private final Texture defaultTexture ;
119128
120129 MapFeature (String name , int structureId , int dimension , int availableSince , String displayName , String directory , int textureWidth , int textureHeight ) {
@@ -126,7 +135,9 @@ public Texture getVariantTexture(WorldIdentifier identifier, int posX, int posZ,
126135 this .structureId = structureId ;
127136 this .dimension = dimension ;
128137 this .availableSince = availableSince ;
129- this .defaultTexture = new Texture (name , directory , textureWidth , textureHeight );
138+ this .translationKey = "seedMap.feature." + name ;
139+ this .displayName = Component .translatableWithFallback (this .translationKey , displayName );
140+ this .defaultTexture = new Texture (textureName , directory , textureWidth , textureHeight );
130141 }
131142
132143 public String getName () {
@@ -145,6 +156,14 @@ public int availableSince() {
145156 return this .availableSince ;
146157 }
147158
159+ public Component getDisplayName () {
160+ return this .displayName ;
161+ }
162+
163+ public String getTranslationKey () {
164+ return this .translationKey ;
165+ }
166+
148167 public Texture getDefaultTexture () {
149168 return this .defaultTexture ;
150169 }
0 commit comments