Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plane sound config #7437

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

floridaman
Copy link
Contributor

Resolves #6440

@Redirect(method = "place", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/SoundType;getVolume()F"))
private float modifyVolume(SoundType instance, BlockPlaceContext context) {
if (context.getPlayer() instanceof FakePlayer
&& context.getPlayer().getGameProfile().getName().equals("[AE2]")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather compare the profile UIID than the name here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you guys use a special UUID for the AE2 fakeplayer? My goal was to limit the effect of this volume control to just AE2 fakeplayer events.

private float modifyVolume(SoundType instance, BlockPlaceContext context) {
if (context.getPlayer() instanceof FakePlayer
&& context.getPlayer().getGameProfile().getName().equals("[AE2]")) {
return ((float) AEConfig.instance().getPlaneVolumeLevel()) - 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to look up what the volume actually means in this case, and why you are subtracting 1 :-P

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am new to mixins. The argument I am modifying is in the following line and they add 1.

level.playSound(player, blockPos, this.getPlaceSound(blockState2), SoundSource.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F);

@@ -703,6 +711,7 @@ public CommonConfig(ConfigSection root) {

ConfigSection automation = root.subsection("automation");
formationPlaneEntityLimit = automation.addInt("formationPlaneEntityLimit", 128);
planeVolumeLevel = automation.addDouble("planeVolumeLevel", 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the volume really 0 and has no min/max? It should have a description to say what it is and reduce the volume by default vs. what it is now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going off of the original feedback from @Technici4n who suggested a value from 0 to 1. I could see the argument for either, just let me know. I will look into adding a description though.

@shartte shartte changed the base branch from master to main November 11, 2023 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add config/setting or any other way to reduce Planes sound volume
2 participants