Skip to content

Commit 909bfcd

Browse files
committed
Fixed #352
1 parent 381224c commit 909bfcd

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

src/main/java/eu/ha3/presencefootsteps/world/PFSolver.java

+11-15
Original file line numberDiff line numberDiff line change
@@ -237,30 +237,26 @@ private Association findAssociation(AssociationPool associations, LivingEntity e
237237
target = carpet;
238238
// reference frame moved up by 1
239239
} else {
240-
association = SoundsKey.UNASSIGNED;
241-
pos.move(Direction.DOWN);
242240
// This condition implies that if the carpet is NOT_EMITTER, solving will
243241
// CONTINUE with the actual block surface the player is walking on
244-
if (target.isAir()) {
242+
pos.move(Direction.DOWN);
243+
association = associations.get(pos, target, Substrates.DEFAULT);
244+
245+
// If the block surface we're on is not an emitter, check for fences below us
246+
if (!association.isEmitter() || !association.isResult()) {
245247
pos.move(Direction.DOWN);
246248
BlockState fence = getBlockStateAt(entity, pos);
247249

248250
// Only check fences if we're actually touching them
249-
if (checkCollision(entity.getWorld(), fence, pos, collider)) {
250-
if ((association = associations.get(pos, fence, Substrates.FENCE)).isResult()) {
251-
carpet = target;
252-
target = fence;
253-
// reference frame moved down by 1
254-
} else {
255-
pos.move(Direction.UP);
256-
}
251+
if (checkCollision(entity.getWorld(), fence, pos, collider) && (association = associations.get(pos, fence, Substrates.FENCE)).isResult()) {
252+
carpet = target;
253+
target = fence;
254+
// reference frame moved down by 1
255+
} else {
256+
pos.move(Direction.UP);
257257
}
258258
}
259259

260-
if (!association.isResult()) {
261-
association = associations.get(pos, target, Substrates.DEFAULT);
262-
}
263-
264260
if (engine.getConfig().foliageSoundsVolume.get() > 0) {
265261
if (entity.getEquippedStack(EquipmentSlot.FEET).isEmpty() || entity.isSprinting()) {
266262
if (association.isEmitter() && carpet.getCollisionShape(entity.getWorld(), pos).isEmpty()) {

0 commit comments

Comments
 (0)