Skip to content

Commit

Permalink
Revert to the previous behaviour where mobs produced both normal and …
Browse files Browse the repository at this point in the history
…presence footsteps and add a toggle to re-enable sounds blocking
  • Loading branch information
Sollace committed May 9, 2024
1 parent ed2f46f commit c6697f3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
11 changes: 11 additions & 0 deletions src/main/java/eu/ha3/presencefootsteps/PFConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class PFConfig extends JsonFile {
private boolean global = true;
private boolean footwear = true;
private boolean visualiser = false;
private boolean exclusive = false;

private Locomotion stance = Locomotion.NONE;
private EntitySelector targetEntities = EntitySelector.ALL;
Expand Down Expand Up @@ -97,6 +98,16 @@ public boolean toggleFootwear() {
return footwear;
}

public boolean isExclusiveMode() {
return exclusive;
}

public boolean toggleExclusiveMode() {
exclusive = !exclusive;
save();
return exclusive;
}

public boolean getEnabledMP() {
return multiplayer;
}
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/eu/ha3/presencefootsteps/PFOptionsScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ private void rebuildContent() {
})).getStyle()
.setText("menu.pf.footwear." + (config.getEnabledFootwear() ? "on" : "off"));

content.addButton(new Button(wideRight, row, 150, 20).onClick(sender -> {
sender.getStyle().setText("menu.pf.exclusive_mode." + (config.toggleExclusiveMode() ? "on" : "off"));
})).getStyle()
.setText("menu.pf.exclusive_mode." + (config.isExclusiveMode() ? "on" : "off"));

content.addButton(new Label(wideLeft, row += 25)).getStyle().setText("menu.pf.group.sound_packs");

content.addButton(new Button(wideLeft, row += 25, 150, 20).onClick(sender -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import eu.ha3.presencefootsteps.sound.generator.Locomotion;
import eu.ha3.presencefootsteps.sound.generator.StepSoundGenerator;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;

public interface StepSoundSource {
Optional<StepSoundGenerator> getStepGenerator(SoundEngine engine);
Expand Down Expand Up @@ -35,8 +36,11 @@ public Optional<StepSoundGenerator> getStepGenerator(SoundEngine engine) {

@Override
public boolean isStepBlocked() {
return PresenceFootsteps.getInstance().getEngine().isEnabledFor(entity)
&& getStepGenerator(PresenceFootsteps.getInstance().getEngine()).isPresent();
SoundEngine engine = PresenceFootsteps.getInstance().getEngine();
if (!engine.getConfig().isExclusiveMode() && !(entity instanceof PlayerEntity)) {
return false;
}
return engine.isEnabledFor(entity) && getStepGenerator(engine).isPresent();
}
}
}
2 changes: 2 additions & 0 deletions src/main/resources/assets/presencefootsteps/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
"menu.pf.volume.passive_entities": "Passive Entities: %d%%",
"menu.pf.footwear.on": "Footwear: ON",
"menu.pf.footwear.off": "Footwear: OFF",
"menu.pf.exclusive_mode.on": "Exclusive Mode: ON",
"menu.pf.exclusive_mode.off": "Exclusive Mode: OFF",
"menu.pf.volume.passive_entities.tooltip": "Changes the volume of animal' footsteps.",
"menu.pf.volume.player": "Client Player: %d%%",
"menu.pf.volume.player.tooltip": "Changes the volume of your own footsteps.",
Expand Down

0 comments on commit c6697f3

Please sign in to comment.