diff --git a/README.md b/README.md index 7a1a182e..d4da6cbc 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java index 6de751f3..2eca4233 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java @@ -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(); @@ -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 { diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java index 8282deb7..a98e85e4 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java @@ -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); diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/sound/broadcast/mixin/UTBroadcastSoundDragonMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/sound/broadcast/mixin/UTBroadcastSoundDragonMixin.java new file mode 100644 index 00000000..0b9bacba --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/sound/broadcast/mixin/UTBroadcastSoundDragonMixin.java @@ -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); + } +} diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/sound/broadcast/mixin/UTBroadcastSoundEndPortalMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/sound/broadcast/mixin/UTBroadcastSoundEndPortalMixin.java new file mode 100644 index 00000000..348fb146 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/sound/broadcast/mixin/UTBroadcastSoundEndPortalMixin.java @@ -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); + } +} diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/sound/broadcast/mixin/UTBroadcastSoundWitherMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/sound/broadcast/mixin/UTBroadcastSoundWitherMixin.java new file mode 100644 index 00000000..cfc02966 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/sound/broadcast/mixin/UTBroadcastSoundWitherMixin.java @@ -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); + } +} diff --git a/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java b/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java index 0c9f3e3a..4dac975a 100644 --- a/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java +++ b/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java @@ -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); diff --git a/src/main/resources/assets/universaltweaks/lang/en_us.lang b/src/main/resources/assets/universaltweaks/lang/en_us.lang index 0774b820..35fae7de 100644 --- a/src/main/resources/assets/universaltweaks/lang/en_us.lang +++ b/src/main/resources/assets/universaltweaks/lang/en_us.lang @@ -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 diff --git a/src/main/resources/mixins.tweaks.misc.sound.broadcast.dragon.json b/src/main/resources/mixins.tweaks.misc.sound.broadcast.dragon.json new file mode 100644 index 00000000..3b64de71 --- /dev/null +++ b/src/main/resources/mixins.tweaks.misc.sound.broadcast.dragon.json @@ -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"] +} \ No newline at end of file diff --git a/src/main/resources/mixins.tweaks.misc.sound.broadcast.endportal.json b/src/main/resources/mixins.tweaks.misc.sound.broadcast.endportal.json new file mode 100644 index 00000000..243509fa --- /dev/null +++ b/src/main/resources/mixins.tweaks.misc.sound.broadcast.endportal.json @@ -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"] +} \ No newline at end of file diff --git a/src/main/resources/mixins.tweaks.misc.sound.broadcast.wither.json b/src/main/resources/mixins.tweaks.misc.sound.broadcast.wither.json new file mode 100644 index 00000000..921de68d --- /dev/null +++ b/src/main/resources/mixins.tweaks.misc.sound.broadcast.wither.json @@ -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"] +} \ No newline at end of file