1111import it .unimi .dsi .fastutil .objects .*;
1212import net .minecraft .core .Holder ;
1313import net .minecraft .core .registries .Registries ;
14+ import net .minecraft .resources .Identifier ;
1415import net .minecraft .resources .RegistryOps ;
15- import net .minecraft .resources .ResourceLocation ;
1616import net .minecraft .server .MinecraftServer ;
1717import net .minecraft .world .level .levelgen .feature .ConfiguredFeature ;
1818import net .minecraft .world .level .levelgen .structure .StructureSet ;
@@ -34,7 +34,7 @@ public class SeedManager {
3434
3535 private static final Codec <Map <Holder <StructureSet >, Integer >> STRUCTURE_SEEDS_MAP_CODEC = Codec .unboundedMap (StructureSet .CODEC , Codec .INT );
3636 private static final Codec <Map <Holder <ConfiguredFeature <?, ?>>, Long >> FEATURE_SEEDS_MAP_CODEC = Codec .unboundedMap (ConfiguredFeature .CODEC , Codec .LONG );
37- private static final Codec <Map <ResourceLocation , Long >> SURFACE_RULE_SEEDS_MAP_CODEC = Codec .unboundedMap (ResourceLocation .CODEC , Codec .LONG );
37+ private static final Codec <Map <Identifier , Long >> SURFACE_RULE_SEEDS_MAP_CODEC = Codec .unboundedMap (Identifier .CODEC , Codec .LONG );
3838 private static final String STRUCTURE_SEEDS_FILE = "structure-seeds.json" ;
3939 private static final String FEATURE_SEEDS_FILE = "feature-seeds.json" ;
4040 private static final String SURFACE_RULE_SEEDS_FILE = "surface-rule-seeds.json" ;
@@ -46,7 +46,7 @@ public class SeedManager {
4646 private static final SecureRandom random = new SecureRandom ();
4747 private static final Reference2IntMap <Holder <StructureSet >> structureSeeds = new Reference2IntOpenHashMap <>();
4848 private static final Reference2LongMap <Holder <ConfiguredFeature <?, ?>>> featureSeeds = new Reference2LongOpenHashMap <>();
49- private static final Object2LongMap <ResourceLocation > surfaceRuleSeeds = new Object2LongOpenHashMap <>();
49+ private static final Object2LongMap <Identifier > surfaceRuleSeeds = new Object2LongOpenHashMap <>();
5050 public static final Logger LOGGER = LoggerFactory .getLogger ("SeedManager" );
5151
5252 public static void load (MinecraftServer server ) {
@@ -64,7 +64,7 @@ public static void load(MinecraftServer server) {
6464 featureSeeds .computeIfAbsent (holder , ignored -> random .nextLong ());
6565 });
6666 for (String vanillaSurfaceRule : VANILLA_SURFACE_RULES ) {
67- surfaceRuleSeeds .computeIfAbsent (ResourceLocation .parse (vanillaSurfaceRule ), ignored -> random .nextLong ());
67+ surfaceRuleSeeds .computeIfAbsent (Identifier .parse (vanillaSurfaceRule ), ignored -> random .nextLong ());
6868 }
6969 save (server );
7070 }
@@ -92,9 +92,9 @@ public static long getFeatureSeed(Holder<ConfiguredFeature<?, ?>> holder) {
9292 return featureSeeds .getLong (holder );
9393 }
9494
95- public static Optional <Long > getSurfaceRuleSeed (ResourceLocation resourceLocation ) {
96- if (surfaceRuleSeeds .containsKey (resourceLocation )) {
97- return Optional .of (surfaceRuleSeeds .getLong (resourceLocation ));
95+ public static Optional <Long > getSurfaceRuleSeed (Identifier identifier ) {
96+ if (surfaceRuleSeeds .containsKey (identifier )) {
97+ return Optional .of (surfaceRuleSeeds .getLong (identifier ));
9898 }
9999 return Optional .empty ();
100100 }
0 commit comments