@@ -237,30 +237,26 @@ private Association findAssociation(AssociationPool associations, LivingEntity e
237
237
target = carpet ;
238
238
// reference frame moved up by 1
239
239
} else {
240
- association = SoundsKey .UNASSIGNED ;
241
- pos .move (Direction .DOWN );
242
240
// This condition implies that if the carpet is NOT_EMITTER, solving will
243
241
// 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 ()) {
245
247
pos .move (Direction .DOWN );
246
248
BlockState fence = getBlockStateAt (entity , pos );
247
249
248
250
// 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 );
257
257
}
258
258
}
259
259
260
- if (!association .isResult ()) {
261
- association = associations .get (pos , target , Substrates .DEFAULT );
262
- }
263
-
264
260
if (engine .getConfig ().foliageSoundsVolume .get () > 0 ) {
265
261
if (entity .getEquippedStack (EquipmentSlot .FEET ).isEmpty () || entity .isSprinting ()) {
266
262
if (association .isEmitter () && carpet .getCollisionShape (entity .getWorld (), pos ).isEmpty ()) {
0 commit comments