diff --git a/gradle.properties b/gradle.properties index 173287c5..32e4ae89 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,10 +3,10 @@ org.gradle.daemon=false # Fabric Properties # check these on https://fabricmc.net/develop - minecraft_version=1.20.5 - yarn_mappings=1.20.5+build.1 - loader_version=0.15.7 - fabric_version=0.97.5+1.20.5 + minecraft_version=1.21-pre2 + yarn_mappings=1.21-pre2+build.2 + loader_version=0.15.11 + fabric_version=0.99.4+1.21 # Mod Properties group=com.presencefootsteps @@ -21,7 +21,7 @@ org.gradle.daemon=false modrinth_project_id=rcTfTZr3 # Dependencies - modmenu_version=10.0.0-beta.1 - minelp_version=4.11.8-beta.7+1.20.5 - kirin_version=1.18.0+1.20.5 + modmenu_version=11.0.0-beta.1 + minelp_version=4.12.0-beta.2+1.21 + kirin_version=1.19.0-beta.5+1.21 pehkui_version=3.7.2 diff --git a/src/main/java/eu/ha3/presencefootsteps/PresenceFootsteps.java b/src/main/java/eu/ha3/presencefootsteps/PresenceFootsteps.java index 63abf19c..b73a9032 100644 --- a/src/main/java/eu/ha3/presencefootsteps/PresenceFootsteps.java +++ b/src/main/java/eu/ha3/presencefootsteps/PresenceFootsteps.java @@ -38,6 +38,10 @@ public class PresenceFootsteps implements ClientModInitializer { public static final Text MOD_NAME = Text.translatable("mod.presencefootsteps.name"); private static final Text SOUND_PACK_NAME = Text.translatable("pf.default_sounds.name"); + public static Identifier id(String name) { + return Identifier.of(MODID, name); + } + private static PresenceFootsteps instance; public static PresenceFootsteps getInstance() { @@ -99,7 +103,7 @@ public void onInitializeClient() { ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(engine); FabricLoader.getInstance().getModContainer("presencefootsteps").ifPresent(container -> { - ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("presencefootsteps", "default_sound_pack"), container, SOUND_PACK_NAME, ResourcePackActivationType.DEFAULT_ENABLED); + ResourceManagerHelper.registerBuiltinResourcePack(id("default_sound_pack"), container, SOUND_PACK_NAME, ResourcePackActivationType.DEFAULT_ENABLED); }); } diff --git a/src/main/java/eu/ha3/presencefootsteps/sound/Isolator.java b/src/main/java/eu/ha3/presencefootsteps/sound/Isolator.java index afc60bb3..0c613e3b 100644 --- a/src/main/java/eu/ha3/presencefootsteps/sound/Isolator.java +++ b/src/main/java/eu/ha3/presencefootsteps/sound/Isolator.java @@ -3,6 +3,7 @@ import java.io.IOException; import java.util.Map; +import eu.ha3.presencefootsteps.PresenceFootsteps; import eu.ha3.presencefootsteps.config.Variator; import eu.ha3.presencefootsteps.sound.acoustics.AcousticLibrary; import eu.ha3.presencefootsteps.sound.acoustics.AcousticsFile; @@ -36,12 +37,12 @@ public record Isolator ( Lookup primitives, AcousticLibrary acoustics ) implements Reportable { - private static final Identifier BLOCK_MAP = new Identifier("presencefootsteps", "config/blockmap.json"); - private static final Identifier GOLEM_MAP = new Identifier("presencefootsteps", "config/golemmap.json"); - private static final Identifier LOCOMOTION_MAP = new Identifier("presencefootsteps", "config/locomotionmap.json"); - private static final Identifier PRIMITIVE_MAP = new Identifier("presencefootsteps", "config/primitivemap.json"); - public static final Identifier ACOUSTICS = new Identifier("presencefootsteps", "config/acoustics.json"); - private static final Identifier VARIATOR = new Identifier("presencefootsteps", "config/variator.json"); + private static final Identifier BLOCK_MAP = PresenceFootsteps.id("config/blockmap.json"); + private static final Identifier GOLEM_MAP = PresenceFootsteps.id("config/golemmap.json"); + private static final Identifier LOCOMOTION_MAP = PresenceFootsteps.id("config/locomotionmap.json"); + private static final Identifier PRIMITIVE_MAP = PresenceFootsteps.id("config/primitivemap.json"); + public static final Identifier ACOUSTICS = PresenceFootsteps.id("config/acoustics.json"); + private static final Identifier VARIATOR = PresenceFootsteps.id("config/variator.json"); public Isolator(SoundEngine engine) { this(new Variator(), diff --git a/src/main/java/eu/ha3/presencefootsteps/sound/SoundEngine.java b/src/main/java/eu/ha3/presencefootsteps/sound/SoundEngine.java index 2ef2ed96..20cc559e 100644 --- a/src/main/java/eu/ha3/presencefootsteps/sound/SoundEngine.java +++ b/src/main/java/eu/ha3/presencefootsteps/sound/SoundEngine.java @@ -12,6 +12,7 @@ import org.jetbrains.annotations.Nullable; import eu.ha3.presencefootsteps.PFConfig; +import eu.ha3.presencefootsteps.PresenceFootsteps; import eu.ha3.presencefootsteps.sound.player.ImmediateSoundPlayer; import eu.ha3.presencefootsteps.util.PlayerUtil; import eu.ha3.presencefootsteps.world.Solver; @@ -40,7 +41,7 @@ import net.minecraft.util.profiler.Profiler; public class SoundEngine implements IdentifiableResourceReloadListener { - private static final Identifier ID = new Identifier("presencefootsteps", "sounds"); + private static final Identifier ID = PresenceFootsteps.id("sounds"); private Isolator isolator = new Isolator(this); private final Solver solver = new PFSolver(this); diff --git a/src/main/java/eu/ha3/presencefootsteps/sound/player/ImmediateSoundPlayer.java b/src/main/java/eu/ha3/presencefootsteps/sound/player/ImmediateSoundPlayer.java index 3a352825..7b9d735e 100644 --- a/src/main/java/eu/ha3/presencefootsteps/sound/player/ImmediateSoundPlayer.java +++ b/src/main/java/eu/ha3/presencefootsteps/sound/player/ImmediateSoundPlayer.java @@ -68,7 +68,7 @@ public float getMaxVolume() { private static Identifier getSoundId(String name, Entity location) { if (name.indexOf(':') >= 0) { - return new Identifier(name); + return Identifier.of(name); } String domain = "presencefootsteps"; @@ -77,7 +77,7 @@ private static Identifier getSoundId(String name, Entity location) { domain += "mono"; // Switch to mono if playing another player } - return new Identifier(domain, name); + return Identifier.of(domain, name); } } } diff --git a/src/main/java/eu/ha3/presencefootsteps/world/AbstractSubstrateLookup.java b/src/main/java/eu/ha3/presencefootsteps/world/AbstractSubstrateLookup.java index 1d13e161..3ed0288e 100644 --- a/src/main/java/eu/ha3/presencefootsteps/world/AbstractSubstrateLookup.java +++ b/src/main/java/eu/ha3/presencefootsteps/world/AbstractSubstrateLookup.java @@ -50,7 +50,7 @@ public void add(String key, String value) { substrates .computeIfAbsent(substrate, s -> new Object2ObjectLinkedOpenHashMap<>()) - .put(new Identifier(primitive), SoundsKey.of(value)); + .put(Identifier.of(primitive), SoundsKey.of(value)); } @Override diff --git a/src/main/java/eu/ha3/presencefootsteps/world/HeuristicStateLookup.java b/src/main/java/eu/ha3/presencefootsteps/world/HeuristicStateLookup.java index 0b77d964..50542be4 100644 --- a/src/main/java/eu/ha3/presencefootsteps/world/HeuristicStateLookup.java +++ b/src/main/java/eu/ha3/presencefootsteps/world/HeuristicStateLookup.java @@ -16,7 +16,7 @@ public class HeuristicStateLookup { String id = Registries.BLOCK.getId(block).getPath(); for (String part : id.split("_")) { - Optional leavesBlock = Registries.BLOCK.getOrEmpty(new Identifier(part + "_leaves")); + Optional leavesBlock = Registries.BLOCK.getOrEmpty(Identifier.of(part + "_leaves")); if (leavesBlock.isPresent()) { return leavesBlock; } diff --git a/src/main/java/eu/ha3/presencefootsteps/world/LocomotionLookup.java b/src/main/java/eu/ha3/presencefootsteps/world/LocomotionLookup.java index e0a12438..7285a431 100644 --- a/src/main/java/eu/ha3/presencefootsteps/world/LocomotionLookup.java +++ b/src/main/java/eu/ha3/presencefootsteps/world/LocomotionLookup.java @@ -36,7 +36,7 @@ public Locomotion lookup(Entity key) { @Override public void add(String key, String value) { - Identifier id = new Identifier(key); + Identifier id = Identifier.of(key); if (!Registries.ENTITY_TYPE.containsId(id)) { PresenceFootsteps.logger.warn("Locomotion registered for unknown entity type " + id); diff --git a/src/main/java/eu/ha3/presencefootsteps/world/StateLookup.java b/src/main/java/eu/ha3/presencefootsteps/world/StateLookup.java index b552196f..32b0a348 100644 --- a/src/main/java/eu/ha3/presencefootsteps/world/StateLookup.java +++ b/src/main/java/eu/ha3/presencefootsteps/world/StateLookup.java @@ -245,7 +245,7 @@ private record Key( boolean isTag, boolean isWildcard ) { - public static final Key NULL = new Key(new Identifier("air"), "", ObjectSets.emptySet(), SoundsKey.UNASSIGNED, true, false, false); + public static final Key NULL = new Key(Identifier.ofVanilla("air"), "", ObjectSets.emptySet(), SoundsKey.UNASSIGNED, true, false, false); public static Key of(String key, SoundsKey value) { final boolean isTag = key.indexOf('#') == 0; @@ -256,14 +256,14 @@ public static Key of(String key, SoundsKey value) { final String id = key.split("[\\.\\[]")[0]; final boolean isWildcard = id.indexOf('*') == 0; - Identifier identifier = new Identifier("air"); + Identifier identifier = NULL.identifier(); if (!isWildcard) { if (id.indexOf('^') > -1) { - identifier = new Identifier(id.split("\\^")[0]); + identifier = Identifier.of(id.split("\\^")[0]); PresenceFootsteps.logger.warn("Metadata entry for " + key + "=" + value.raw() + " was ignored"); } else { - identifier = new Identifier(id); + identifier = Identifier.of(id); } if (!isTag && !Registries.BLOCK.containsId(identifier)) {