Skip to content

Commit

Permalink
Merge branch '1.20.1' into 1.20.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Sollace committed Mar 9, 2024
2 parents 5799b0e + 1f8b52d commit 8867715
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/main/java/eu/ha3/presencefootsteps/PFDebugHud.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public void render(HitResult blockHit, HitResult fluidHit, List<String> finalLis
config.otherPlayerVolume
));
list.add(String.format("Stepping Mode: %s, Targeting Mode: %s, Footwear: %s", config.getLocomotion() == Locomotion.NONE
? String.format("AUTO (%sDETECTED %s%s)", Formatting.BOLD, Locomotion.forPlayer(client.player, Locomotion.BIPED), Formatting.RESET)
: config.getLocomotion().toString(), config.getEntitySelector(), config.getEnabledFootwear()));
? String.format("AUTO (%sDETECTED %s%s)", Formatting.BOLD, Locomotion.forPlayer(client.player, Locomotion.NONE), Formatting.RESET)
: config.getLocomotion(), config.getEntitySelector(), config.getEnabledFootwear()));
list.add(String.format("Data Loaded: B%s P%s G%s",
engine.getIsolator().blocks().getSubstrates().size(),
engine.getIsolator().primitives().getSubstrates().size(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import eu.ha3.presencefootsteps.sound.SoundEngine;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
Expand Down Expand Up @@ -53,10 +52,6 @@ public Text getOptionTooltip() {
return Text.translatable(translationKey + ".tooltip");
}

public String getDisplayName() {
return I18n.translate("pf.stance", I18n.translate(translationKey));
}

public static Locomotion byName(String name) {
return registry.getOrDefault(name, BIPED);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ public SoundsKey get(BlockPos pos, BlockState state, String substrate) {
getForState(state, substrate)
|| (!baseState.isAir() && (
getForState(baseState, substrate)
|| (!Substrates.DEFAULT.equals(substrate) && getForState(baseState, Substrates.DEFAULT))
|| getForPrimitive(baseState)
|| (!Substrates.isDefault(substrate) && getForState(baseState, Substrates.DEFAULT))
|| (getForPrimitive(baseState, substrate))
))
|| getForPrimitive(state)
|| getForPrimitive(state, substrate)
)) {
return association;
}
Expand All @@ -93,7 +93,10 @@ private boolean getForState(BlockState state, String substrate) {
return (association = engine.getIsolator().blocks().getAssociation(state, substrate)).isResult();
}

private boolean getForPrimitive(BlockState state) {
private boolean getForPrimitive(BlockState state, String substrate) {
if (Substrates.isSupplimentary(substrate)) {
return false;
}
BlockSoundGroup sounds = state.getSoundGroup();
return (association = engine.getIsolator().primitives().getAssociation(sounds.getStepSound(), PrimitiveLookup.getSubstrate(sounds))).isResult();
}
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/eu/ha3/presencefootsteps/world/PFSolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,8 @@
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.World;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class PFSolver implements Solver {
private static final Logger LOGGER = LogManager.getLogger("PFSolver");

private static final double TRAP_DOOR_OFFSET = 0.1;

private final SoundEngine engine;
Expand Down Expand Up @@ -217,7 +213,6 @@ private Association findAssociation(AssociationPool associations, LivingEntity e
SoundsKey wetAssociation = SoundsKey.UNASSIGNED;

if (isValidCarpet && (association = associations.get(pos, carpet, Substrates.CARPET)).isEmitter()) {
LOGGER.debug("Carpet detected: " + association);
target = carpet;
// reference frame moved up by 1
} else {
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/eu/ha3/presencefootsteps/world/Substrates.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
package eu.ha3.presencefootsteps.world;

import java.util.Set;

public interface Substrates {
String DEFAULT = "";
String CARPET = "carpet";
String WET = "wet";
String FENCE = "bigger";
String FOLIAGE = "foliage";
String MESSY = "messy";

Set<String> SUPPLIMENTART_SUBSTRATES = Set.of(WET, FOLIAGE, MESSY);

static boolean isDefault(String substrate) {
return Substrates.DEFAULT.equals(substrate);
}

static boolean isSupplimentary(String substrate) {
return SUPPLIMENTART_SUBSTRATES.contains(substrate);
}
}

0 comments on commit 8867715

Please sign in to comment.