Skip to content

Commit

Permalink
Fixed #352
Browse files Browse the repository at this point in the history
  • Loading branch information
Sollace committed Dec 12, 2024
1 parent 381224c commit 909bfcd
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions src/main/java/eu/ha3/presencefootsteps/world/PFSolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -237,30 +237,26 @@ private Association findAssociation(AssociationPool associations, LivingEntity e
target = carpet;
// reference frame moved up by 1
} else {
association = SoundsKey.UNASSIGNED;
pos.move(Direction.DOWN);
// This condition implies that if the carpet is NOT_EMITTER, solving will
// CONTINUE with the actual block surface the player is walking on
if (target.isAir()) {
pos.move(Direction.DOWN);
association = associations.get(pos, target, Substrates.DEFAULT);

// If the block surface we're on is not an emitter, check for fences below us
if (!association.isEmitter() || !association.isResult()) {
pos.move(Direction.DOWN);
BlockState fence = getBlockStateAt(entity, pos);

// Only check fences if we're actually touching them
if (checkCollision(entity.getWorld(), fence, pos, collider)) {
if ((association = associations.get(pos, fence, Substrates.FENCE)).isResult()) {
carpet = target;
target = fence;
// reference frame moved down by 1
} else {
pos.move(Direction.UP);
}
if (checkCollision(entity.getWorld(), fence, pos, collider) && (association = associations.get(pos, fence, Substrates.FENCE)).isResult()) {
carpet = target;
target = fence;
// reference frame moved down by 1
} else {
pos.move(Direction.UP);
}
}

if (!association.isResult()) {
association = associations.get(pos, target, Substrates.DEFAULT);
}

if (engine.getConfig().foliageSoundsVolume.get() > 0) {
if (entity.getEquippedStack(EquipmentSlot.FEET).isEmpty() || entity.isSprinting()) {
if (association.isEmitter() && carpet.getCollisionShape(entity.getWorld(), pos).isEmpty()) {
Expand Down

0 comments on commit 909bfcd

Please sign in to comment.