Skip to content

Commit 381224c

Browse files
committed
Fixed golem sounds not playing for flying boats
1 parent 3388647 commit 381224c

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

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

+5-4
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,27 @@ public record Association (
1313
BlockState state,
1414
BlockPos pos,
1515
@Nullable LivingEntity source,
16+
boolean forcePlay,
1617

1718
SoundsKey dry,
1819
SoundsKey wet,
1920
SoundsKey foliage
2021
) {
21-
public static final Association NOT_EMITTER = new Association(Blocks.AIR.getDefaultState(), BlockPos.ORIGIN, null, SoundsKey.NON_EMITTER, SoundsKey.NON_EMITTER, SoundsKey.NON_EMITTER);
22+
public static final Association NOT_EMITTER = new Association(Blocks.AIR.getDefaultState(), BlockPos.ORIGIN, null, false, SoundsKey.NON_EMITTER, SoundsKey.NON_EMITTER, SoundsKey.NON_EMITTER);
2223

23-
public static Association of(BlockState state, BlockPos pos, LivingEntity source, SoundsKey dry, SoundsKey wet, SoundsKey foliage) {
24+
public static Association of(BlockState state, BlockPos pos, LivingEntity source, boolean forcePlay, SoundsKey dry, SoundsKey wet, SoundsKey foliage) {
2425
if (dry.isSilent() && wet.isSilent() && foliage.isSilent()) {
2526
return NOT_EMITTER;
2627
}
27-
return new Association(state, pos.toImmutable(), source, dry, wet, foliage);
28+
return new Association(state, pos.toImmutable(), source, forcePlay, dry, wet, foliage);
2829
}
2930

3031
public boolean isResult() {
3132
return dry.isResult() || wet.isResult() || foliage.isResult();
3233
}
3334

3435
public boolean isSilent() {
35-
return this == NOT_EMITTER || state.isAir();
36+
return this == NOT_EMITTER || (state.isAir() && !forcePlay);
3637
}
3738

3839
public boolean dataEquals(Association other) {

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

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ public SoundsKey get(BlockPos pos, BlockState state, String substrate) {
6969
return !e.isCollidable() || e.getBoundingBox().maxY < entity.getY() + 0.2F;
7070
})) {
7171
if ((association = engine.getIsolator().golems().getAssociation(golem.getType(), substrate)).isEmitter()) {
72+
wasGolem = true;
7273
return association;
7374
}
7475
}

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public Association findAssociation(AssociationPool associations, LivingEntity pl
8080

8181
// we discard the normal block association, and mark the foliage as detected
8282
if (foliage.isEmitter() && engine.getIsolator().blocks().getAssociation(above, Substrates.MESSY) == SoundsKey.MESSY_GROUND) {
83-
return Association.of(above, pos, ply, SoundsKey.NON_EMITTER, SoundsKey.NON_EMITTER, foliage);
83+
return Association.of(above, pos, ply, false, SoundsKey.NON_EMITTER, SoundsKey.NON_EMITTER, foliage);
8484
}
8585

8686
return Association.NOT_EMITTER;
@@ -211,9 +211,9 @@ private Association findAssociation(AssociationPool associations, LivingEntity p
211211

212212
if (state.isLiquid()) {
213213
if (state.getFluidState().isIn(FluidTags.LAVA)) {
214-
return Association.of(state, pos.down(), player, SoundsKey.LAVAFINE, SoundsKey.NON_EMITTER, SoundsKey.NON_EMITTER);
214+
return Association.of(state, pos.down(), player, false, SoundsKey.LAVAFINE, SoundsKey.NON_EMITTER, SoundsKey.NON_EMITTER);
215215
}
216-
return Association.of(state, pos.down(), player, SoundsKey.WATERFINE, SoundsKey.NON_EMITTER, SoundsKey.NON_EMITTER);
216+
return Association.of(state, pos.down(), player, false, SoundsKey.WATERFINE, SoundsKey.NON_EMITTER, SoundsKey.NON_EMITTER);
217217
}
218218

219219
return association;
@@ -291,6 +291,6 @@ private Association findAssociation(AssociationPool associations, LivingEntity e
291291
wetAssociation = associations.get(pos, target, Substrates.WET);
292292
}
293293

294-
return Association.of(target, pos, entity, association, wetAssociation, foliage);
294+
return Association.of(target, pos, entity, associations.wasLastMatchGolem() && entity.isOnGround(), association, wetAssociation, foliage);
295295
}
296296
}

0 commit comments

Comments
 (0)