Skip to content

Commit

Permalink
1.20.5 -> 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
Sollace committed Jun 8, 2024
1 parent a28d005 commit d8d75a1
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 24 deletions.
14 changes: 7 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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);
});
}

Expand Down
13 changes: 7 additions & 6 deletions src/main/java/eu/ha3/presencefootsteps/sound/Isolator.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -36,12 +37,12 @@ public record Isolator (
Lookup<SoundEvent> 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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class HeuristicStateLookup {
String id = Registries.BLOCK.getId(block).getPath();

for (String part : id.split("_")) {
Optional<Block> leavesBlock = Registries.BLOCK.getOrEmpty(new Identifier(part + "_leaves"));
Optional<Block> leavesBlock = Registries.BLOCK.getOrEmpty(Identifier.of(part + "_leaves"));
if (leavesBlock.isPresent()) {
return leavesBlock;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/eu/ha3/presencefootsteps/world/StateLookup.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)) {
Expand Down

0 comments on commit d8d75a1

Please sign in to comment.