From b8aa61a48691ebcc13e3b2228eff06d80b41388d Mon Sep 17 00:00:00 2001 From: Sollace Date: Mon, 11 Mar 2024 01:06:49 +0000 Subject: [PATCH 1/3] Fix crash with null stance in the config --- .../java/eu/ha3/presencefootsteps/PFConfig.java | 14 ++++++++------ .../sound/generator/Locomotion.java | 3 ++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/eu/ha3/presencefootsteps/PFConfig.java b/src/main/java/eu/ha3/presencefootsteps/PFConfig.java index 9c04754a..468582c1 100644 --- a/src/main/java/eu/ha3/presencefootsteps/PFConfig.java +++ b/src/main/java/eu/ha3/presencefootsteps/PFConfig.java @@ -23,7 +23,7 @@ public class PFConfig extends JsonFile { private int maxSteppingEntities = 50; - private boolean disabled; + private boolean disabled = false; private boolean firstRun = true; private boolean multiplayer = true; private boolean global = true; @@ -47,7 +47,7 @@ public boolean toggleMultiplayer() { } public EntitySelector cycleTargetSelector() { - targetEntities = EntitySelector.VALUES[(targetEntities.ordinal() + 1) % EntitySelector.VALUES.length]; + targetEntities = EntitySelector.VALUES[(getEntitySelector().ordinal() + 1) % EntitySelector.VALUES.length]; save(); @@ -75,11 +75,11 @@ public void setNotFirstRun() { } public Locomotion getLocomotion() { - return stance; + return stance == null ? Locomotion.NONE : stance; } public EntitySelector getEntitySelector() { - return targetEntities; + return targetEntities == null ? EntitySelector.ALL : targetEntities; } public boolean getEnabledFootwear() { @@ -154,8 +154,10 @@ public float setRunningVolumeIncrease(float volume) { } public void populateCrashReport(CrashReportSection section) { - section.add("PF Global Volume", volume); - section.add("PF User's Selected Stance", stance); + section.add("Disabled", getDisabled()); + section.add("Global Volume", volume); + section.add("User's Selected Stance", getLocomotion()); + section.add("Target Selector", getEntitySelector()); section.add("Enabled Global", global); section.add("Enabled Multiplayer", multiplayer); } diff --git a/src/main/java/eu/ha3/presencefootsteps/sound/generator/Locomotion.java b/src/main/java/eu/ha3/presencefootsteps/sound/generator/Locomotion.java index 5d6a3af3..4d408d83 100644 --- a/src/main/java/eu/ha3/presencefootsteps/sound/generator/Locomotion.java +++ b/src/main/java/eu/ha3/presencefootsteps/sound/generator/Locomotion.java @@ -1,5 +1,6 @@ package eu.ha3.presencefootsteps.sound.generator; +import java.util.Locale; import java.util.Map; import java.util.Optional; import java.util.function.BiFunction; @@ -30,7 +31,7 @@ public enum Locomotion { private final BiFunction> constructor; private static final String AUTO_TRANSLATION_KEY = "menu.pf.stance.auto"; - private final String translationKey = "menu.pf.stance." + name().toLowerCase(); + private final String translationKey = "menu.pf.stance." + name().toLowerCase(Locale.ROOT); Locomotion() { constructor = (entity, engine) -> Optional.empty(); From add05282d132d0d15fd143b8974328928bcb1c20 Mon Sep 17 00:00:00 2001 From: Sollace Date: Mon, 11 Mar 2024 01:23:28 +0000 Subject: [PATCH 2/3] Fixed snow not producing footsteps #283 --- src/main/java/eu/ha3/presencefootsteps/world/PFSolver.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/ha3/presencefootsteps/world/PFSolver.java b/src/main/java/eu/ha3/presencefootsteps/world/PFSolver.java index ed19ffda..8f3e0976 100644 --- a/src/main/java/eu/ha3/presencefootsteps/world/PFSolver.java +++ b/src/main/java/eu/ha3/presencefootsteps/world/PFSolver.java @@ -206,8 +206,8 @@ private Association findAssociation(AssociationPool associations, LivingEntity e pos.move(Direction.UP); final boolean hasRain = entity.getWorld().hasRain(pos); BlockState carpet = getBlockStateAt(entity, pos); - VoxelShape shape = carpet.getCollisionShape(entity.getWorld(), pos); - boolean isValidCarpet = !shape.isEmpty() && (shape.getMax(Axis.Y) < 0.2F && shape.getMax(Axis.Y) < collider.getMin(Axis.Y) + 0.1F); + VoxelShape shape = carpet.getOutlineShape(entity.getWorld(), pos); + boolean isValidCarpet = !shape.isEmpty() && shape.getMax(Axis.Y) < 0.3F; SoundsKey association = SoundsKey.UNASSIGNED; SoundsKey foliage = SoundsKey.UNASSIGNED; SoundsKey wetAssociation = SoundsKey.UNASSIGNED; From 10dd4bc3c3307a99b51b36f236354757a8656c8c Mon Sep 17 00:00:00 2001 From: Sollace Date: Sat, 16 Mar 2024 21:48:02 +0000 Subject: [PATCH 3/3] Fix crash when generating a report. Closes #287 --- .../java/eu/ha3/presencefootsteps/world/LocomotionLookup.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/ha3/presencefootsteps/world/LocomotionLookup.java b/src/main/java/eu/ha3/presencefootsteps/world/LocomotionLookup.java index 3e7f724c..e0a12438 100644 --- a/src/main/java/eu/ha3/presencefootsteps/world/LocomotionLookup.java +++ b/src/main/java/eu/ha3/presencefootsteps/world/LocomotionLookup.java @@ -56,9 +56,9 @@ public void writeToReport(boolean full, JsonObjectWriter writer, Map