Skip to content

Commit

Permalink
Implement Broadcast Sounds tweak
Browse files Browse the repository at this point in the history
Supersedes "Bad Wither No Cookie! Reloaded"
  • Loading branch information
ACGaming committed Dec 12, 2024
1 parent e4135cb commit 42ef114
Show file tree
Hide file tree
Showing 11 changed files with 105 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ All changes are toggleable via config files.
* **Mending and Infinity:** Allows the Infinity Enchantment to be combined with Mending
* **Infinity Affects All Arrows:** Allows the Infinity Enchantment to apply to all arrows (e.g. Tipped Arrows)
* **Breakable Bedrock:** Allows customizable mining of bedrock
* **Broadcast Sounds:** Controls broadcasting of Ender Dragon, End portal creation and Wither sounds
* **Burning Baby Zombies:** Lets baby zombies burn in daylight as in Minecraft 1.13+
* **Burning Skeletons:** Prevents skeletons burning in daylight
* **Burning Zombies:** Prevents zombies burning in daylight
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1406,6 +1406,10 @@ public static class MiscCategory
@Config.Name("Armor Curve")
public final ArmorCurveCategory ARMOR_CURVE = new ArmorCurveCategory();

@Config.LangKey("cfg.universaltweaks.tweaks.misc.sound.broadcast")
@Config.Name("Broadcast Sounds")
public final BroadcastSoundsCategory BROADCAST_SOUNDS = new BroadcastSoundsCategory();

@Config.LangKey("cfg.universaltweaks.tweaks.misc.chat")
@Config.Name("Chat")
public final ChatCategory CHAT = new ChatCategory();
Expand Down Expand Up @@ -1780,6 +1784,23 @@ public static class ChatCategory
public boolean utCompactMessagesToggle = false;
}

public static class BroadcastSoundsCategory
{
@Config.RequiresMcRestart
@Config.Name("Broadcast Ender Dragon Death Sound")
@Config.Comment("Plays the sound locally if disabled")
public boolean utBroadcastSoundDragon = true;

@Config.RequiresMcRestart
@Config.Name("Broadcast End Portal Creation Sound")
@Config.Comment("Plays the sound locally if disabled")
public boolean utBroadcastSoundEndPortal = true;

@Config.RequiresMcRestart
@Config.Name("Broadcast Wither Death Sound")
@Config.Comment("Plays the sound locally if disabled")
public boolean utBroadcastSoundWither = true;
}

public static class IncurablePotionsCategory
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader
put("mixins.tweaks.misc.lightning.damage.json", () -> UTConfigTweaks.MISC.LIGHTNING.utLightningDamage != 5.0D || UTConfigTweaks.MISC.LIGHTNING.utLightningFireTicks != 8);
put("mixins.tweaks.misc.lightning.fire.json", () -> UTConfigTweaks.MISC.LIGHTNING.utLightningFireToggle);
put("mixins.tweaks.misc.recipebook.server.json", () -> UTConfigTweaks.MISC.utRecipeBookToggle);
put("mixins.tweaks.misc.sound.broadcast.dragon.json", () -> !UTConfigTweaks.MISC.BROADCAST_SOUNDS.utBroadcastSoundDragon);
put("mixins.tweaks.misc.sound.broadcast.endportal.json", () -> !UTConfigTweaks.MISC.BROADCAST_SOUNDS.utBroadcastSoundEndPortal);
put("mixins.tweaks.misc.sound.broadcast.wither.json", () -> !UTConfigTweaks.MISC.BROADCAST_SOUNDS.utBroadcastSoundWither);
put("mixins.tweaks.misc.timeouts.json", () -> UTConfigTweaks.MISC.TIMEOUTS.utTimeoutsToggle);
put("mixins.tweaks.misc.xp.cap.json", () -> UTConfigTweaks.MISC.utXPLevelCap > -1);
put("mixins.tweaks.misc.xp.linear.json", () -> UTConfigTweaks.MISC.utLinearXP > 0);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package mod.acgaming.universaltweaks.tweaks.misc.sound.broadcast.mixin;

import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(EntityDragon.class)
public abstract class UTBroadcastSoundDragonMixin
{
@Redirect(method = "onDeathUpdate", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;playBroadcastSound(ILnet/minecraft/util/math/BlockPos;I)V"))
public void utBroadcastSoundDragon(World world, int id, BlockPos pos, int data)
{
world.playEvent(id, pos, data);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package mod.acgaming.universaltweaks.tweaks.misc.sound.broadcast.mixin;

import net.minecraft.item.ItemEnderEye;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(ItemEnderEye.class)
public abstract class UTBroadcastSoundEndPortalMixin
{
@Redirect(method = "onItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;playBroadcastSound(ILnet/minecraft/util/math/BlockPos;I)V"))
public void utBroadcastSoundEndPortal(World world, int id, BlockPos pos, int data)
{
world.playEvent(id, pos, data);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package mod.acgaming.universaltweaks.tweaks.misc.sound.broadcast.mixin;

import net.minecraft.entity.boss.EntityWither;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(EntityWither.class)
public abstract class UTBroadcastSoundWitherMixin
{
@Redirect(method = "updateAITasks", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;playBroadcastSound(ILnet/minecraft/util/math/BlockPos;I)V"))
public void utBroadcastSoundWither(World world, int id, BlockPos pos, int data)
{
world.playEvent(id, pos, data);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class UTObsoleteModsHandler
put("aiimprovements", () -> UTConfigTweaks.ENTITIES.utAIReplacementToggle || UTConfigTweaks.ENTITIES.utAIRemovalToggle);
put("armorcurve", () -> UTConfigTweaks.MISC.ARMOR_CURVE.utArmorCurveToggle);
put("attributefix", () -> UTConfigTweaks.ENTITIES.ATTRIBUTES.utAttributesToggle);
put("badwithernocookiereloaded", () -> !UTConfigTweaks.MISC.BROADCAST_SOUNDS.utBroadcastSoundDragon || !UTConfigTweaks.MISC.BROADCAST_SOUNDS.utBroadcastSoundEndPortal || !UTConfigTweaks.MISC.BROADCAST_SOUNDS.utBroadcastSoundWither);
put("bannerpatch", () -> UTConfigBugfixes.BLOCKS.utBannerBoundingBoxToggle);
put("bedbreakbegone", () -> UTConfigTweaks.BLOCKS.utBedObstructionToggle);
put("bedfix", () -> UTConfigTweaks.ENTITIES.SLEEPING.utSleepingTime != -1);
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/universaltweaks/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ cfg.universaltweaks.tweaks.misc.loadsounds=Load Sounds
cfg.universaltweaks.tweaks.misc.pickupnotification=Pickup Notification
cfg.universaltweaks.tweaks.misc.smoothscrolling=Smooth Scrolling
cfg.universaltweaks.tweaks.misc.stg=Swing Through Grass
cfg.universaltweaks.tweaks.misc.sound.broadcast=Broadcast Sounds
cfg.universaltweaks.tweaks.misc.timeouts=Connection Timeouts
cfg.universaltweaks.tweaks.misc.toastcontrol=Toast Control
cfg.universaltweaks.tweaks.performance.entityradiuscheck=Entity Radius Check
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"package": "mod.acgaming.universaltweaks.tweaks.misc.sound.broadcast.mixin",
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": ["UTBroadcastSoundDragonMixin"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"package": "mod.acgaming.universaltweaks.tweaks.misc.sound.broadcast.mixin",
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": ["UTBroadcastSoundEndPortalMixin"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"package": "mod.acgaming.universaltweaks.tweaks.misc.sound.broadcast.mixin",
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": ["UTBroadcastSoundWitherMixin"]
}

0 comments on commit 42ef114

Please sign in to comment.