From 3c930e4580ba00b9af843b1585b5b2839c40f492 Mon Sep 17 00:00:00 2001 From: Me <135455255+IcarussOne@users.noreply.github.com> Date: Sat, 13 Jan 2024 02:48:21 -0600 Subject: [PATCH 1/3] Sleep Resets Weather Bugfix -MC-63340 --- README.md | 1 + .../blocks/bed/UTSleepResetsWeatherMixin.java | 22 +++++++++++++++++++ .../config/UTConfigBugfixes.java | 5 +++++ .../universaltweaks/core/UTLoadingPlugin.java | 2 ++ .../resources/mixins.bugfixes.blocks.bed.json | 7 ++++++ 5 files changed, 37 insertions(+) create mode 100644 src/main/java/mod/acgaming/universaltweaks/bugfixes/blocks/bed/UTSleepResetsWeatherMixin.java create mode 100644 src/main/resources/mixins.bugfixes.blocks.bed.json diff --git a/README.md b/README.md index 0bffaa57..b8a1a2da 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ All changes are toggleable via config files. * **Portal Duplication Fix:** Fixes duplication issues that can occur when entities travel through portals * **Shear Mooshroom Dupe:** Fixes a duplication exploit connected to shearing mooshrooms * **Skeleton Aim:** Fixes skeletons not looking at their targets when strafing +* **Sleep Resets Weather:** Fixes sleeping always resetting rain and thunder times * **Tile Entity Map:** Replaces the chunk position data table to prevent tile entity related issues * **Villager Mantle:** Returns missing hoods to villager mantles diff --git a/src/main/java/mod/acgaming/universaltweaks/bugfixes/blocks/bed/UTSleepResetsWeatherMixin.java b/src/main/java/mod/acgaming/universaltweaks/bugfixes/blocks/bed/UTSleepResetsWeatherMixin.java new file mode 100644 index 00000000..ef57fd85 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/bugfixes/blocks/bed/UTSleepResetsWeatherMixin.java @@ -0,0 +1,22 @@ +package mod.acgaming.universaltweaks.bugfixes.blocks.bed.mixin; + +import net.minecraft.world.WorldServer; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +import com.llamalad7.mixinextras.injector.WrapWithCondition; + +import mod.acgaming.universaltweaks.config.UTConfigBugfixes; + +// MC-63340 +// https://bugs.mojang.com/browse/MC-63340 +// Courtesy of fonnymunkey +@Mixin(WorldServer.class) +public abstract class UTSleepResetsWeatherMixin +{ + @WrapWithCondition(method = "wakeAllPlayers", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/WorldServer;resetRainAndThunder()V")) + public boolean utWakeAllPlayers(WorldServer instance) + { + return !UTConfigBugfixes.BLOCKS.utSleepResetsWeatherToggle; + } +} \ No newline at end of file diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigBugfixes.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigBugfixes.java index 5046965c..9910918e 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigBugfixes.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigBugfixes.java @@ -90,6 +90,11 @@ public static class BlocksCategory @Config.Comment("Properly saves the last state of pistons to tags") public boolean utPistonTileToggle = true; + @Config.RequiresMcRestart + @Config.Name("Sleep Resets Weather") + @Config.Comment("Fixes sleeping always resetting rain and thunder times") + public boolean utSleepResetsWeatherToggle = true; + public static class BlockOverlayCategory { @Config.RequiresMcRestart diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java index b421adca..511a7885 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java @@ -322,6 +322,8 @@ public boolean shouldMixinConfigQueue(String mixinConfig) return UTConfigBugfixes.BLOCKS.utMiningGlitchToggle; case "mixins.bugfixes.blocks.pistontile.json": return UTConfigBugfixes.BLOCKS.utPistonTileToggle; + case "mixins.bugfixes.blocks.bed.json": + return UTConfigBugfixes.BLOCKS.utSleepResetsWeatherToggle; case "mixins.bugfixes.misc.packetsize.json": return UTConfigBugfixes.MISC.utPacketSize > 0x200000 && !spongeForgeLoaded && !randomPatchesLoaded; case "mixins.bugfixes.entities.ai.json": diff --git a/src/main/resources/mixins.bugfixes.blocks.bed.json b/src/main/resources/mixins.bugfixes.blocks.bed.json new file mode 100644 index 00000000..79c5637c --- /dev/null +++ b/src/main/resources/mixins.bugfixes.blocks.bed.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.bugfixes.blocks.bed.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "client": ["UTSleepResetsWeatherMixin"] +} \ No newline at end of file From e1ab3a5f4935559f57fde2f6db028671096888c0 Mon Sep 17 00:00:00 2001 From: Me <135455255+IcarussOne@users.noreply.github.com> Date: Sat, 13 Jan 2024 03:45:46 -0600 Subject: [PATCH 2/3] Blast Protection Knockback Bugfix -MC-198809 --- README.md | 1 + .../enchantment/UTBlastProtectionMixin.java | 42 +++++++++++++++++++ .../config/UTConfigBugfixes.java | 5 +++ .../universaltweaks/core/UTLoadingPlugin.java | 2 + .../mixins.bugfixes.misc.enchantment.json | 7 ++++ 5 files changed, 57 insertions(+) create mode 100644 src/main/java/mod/acgaming/universaltweaks/bugfixes/misc/enchantment/UTBlastProtectionMixin.java create mode 100644 src/main/resources/mixins.bugfixes.misc.enchantment.json diff --git a/README.md b/README.md index b8a1a2da..086a3d76 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ All changes are toggleable via config files. * **Accurate Smooth Lighting:** Improves the accuracy of smooth lighting by checking for suffocation and light opacity * **Attack Radius:** Improves the attack radius of hostile mobs by checking the line of sight with raytracing * **Banner Bounding Box:** Fixes rendering issues with banners by correctly sizing their render bounding boxes +* **Blast Protection Knockback:** Fixes the blast protection enchantment not reducing knockback from explosions except at very high levels * **Block Fire:** Prevents fire projectiles burning entities when blocking with shields * **Block Overlay:** Fixes x-ray when standing in non-suffocating blocks * **Boat Riding Offset:** Fixes entities glitching through the bottom of boats diff --git a/src/main/java/mod/acgaming/universaltweaks/bugfixes/misc/enchantment/UTBlastProtectionMixin.java b/src/main/java/mod/acgaming/universaltweaks/bugfixes/misc/enchantment/UTBlastProtectionMixin.java new file mode 100644 index 00000000..9f4a1f17 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/bugfixes/misc/enchantment/UTBlastProtectionMixin.java @@ -0,0 +1,42 @@ +package mod.acgaming.universaltweaks.bugfixes.misc.enchantment.mixin; + +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.enchantment.EnchantmentProtection; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Enchantments; +import net.minecraft.util.math.MathHelper; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; + +import mod.acgaming.universaltweaks.config.UTConfigBugfixes; + +// MC-198809 +// https://bugs.mojang.com/browse/MC-198809 +// Courtesy of fonnymunkey +@Mixin(EnchantmentProtection.class) +public abstract class UTBlastProtectionMixin +{ + /** + * @author fonnymunkey + * @reason Fix blast protection flooring reduction making it not effective + */ + @Overwrite + public static double getBlastDamageReduction(EntityLivingBase entityLivingBaseIn, double damage) + { + int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.BLAST_PROTECTION, entityLivingBaseIn); + + if (i > 0) + { + if (UTConfigBugfixes.MISC.utBlastProtectionKnockbackToggle) + { + damage -= damage * Math.min(1D, (double) ((float) i * 0.15F)); + } else + { + damage -= (double) MathHelper.floor(damage * (double) ((float) i * 0.15F)); + } + } + + return damage; + } +} \ No newline at end of file diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigBugfixes.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigBugfixes.java index 9910918e..5c920287 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigBugfixes.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigBugfixes.java @@ -288,6 +288,11 @@ public static class MiscCategory @Config.Comment("Improves the accuracy of smooth lighting by checking for suffocation and light opacity") public boolean utAccurateSmoothLighting = true; + @Config.RequiresMcRestart + @Config.Name("Blast Protection Knockback") + @Config.Comment("Fixes the blast protection enchantment not reducing knockback from explosions except at very high levels") + public boolean utBlastProtectionKnockbackToggle = true; + @Config.RequiresMcRestart @Config.Name("Depth Mask") @Config.Comment("Fixes entity and particle rendering issues by enabling depth buffer writing") diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java index 511a7885..9d997035 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java @@ -324,6 +324,8 @@ public boolean shouldMixinConfigQueue(String mixinConfig) return UTConfigBugfixes.BLOCKS.utPistonTileToggle; case "mixins.bugfixes.blocks.bed.json": return UTConfigBugfixes.BLOCKS.utSleepResetsWeatherToggle; + case "mixins.bugfixes.misc.enchantment.json": + return UTConfigBugfixes.MISC.utBlastProtectionKnockbackToggle; case "mixins.bugfixes.misc.packetsize.json": return UTConfigBugfixes.MISC.utPacketSize > 0x200000 && !spongeForgeLoaded && !randomPatchesLoaded; case "mixins.bugfixes.entities.ai.json": diff --git a/src/main/resources/mixins.bugfixes.misc.enchantment.json b/src/main/resources/mixins.bugfixes.misc.enchantment.json new file mode 100644 index 00000000..14cbb7b8 --- /dev/null +++ b/src/main/resources/mixins.bugfixes.misc.enchantment.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.bugfixes.misc.enchantment.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "client": ["UTBlastProtectionMixin"] +} \ No newline at end of file From c7d0a45cd642c34ba0a4551ef5340baffeb4d24a Mon Sep 17 00:00:00 2001 From: Me <135455255+IcarussOne@users.noreply.github.com> Date: Sat, 13 Jan 2024 04:05:37 -0600 Subject: [PATCH 3/3] Disable MC-198809 Currently does not function properly due to MC-32578 --- README.md | 1 - .../mod/acgaming/universaltweaks/config/UTConfigBugfixes.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 086a3d76..b8a1a2da 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,6 @@ All changes are toggleable via config files. * **Accurate Smooth Lighting:** Improves the accuracy of smooth lighting by checking for suffocation and light opacity * **Attack Radius:** Improves the attack radius of hostile mobs by checking the line of sight with raytracing * **Banner Bounding Box:** Fixes rendering issues with banners by correctly sizing their render bounding boxes -* **Blast Protection Knockback:** Fixes the blast protection enchantment not reducing knockback from explosions except at very high levels * **Block Fire:** Prevents fire projectiles burning entities when blocking with shields * **Block Overlay:** Fixes x-ray when standing in non-suffocating blocks * **Boat Riding Offset:** Fixes entities glitching through the bottom of boats diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigBugfixes.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigBugfixes.java index 5c920287..ef4f48be 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigBugfixes.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigBugfixes.java @@ -291,7 +291,7 @@ public static class MiscCategory @Config.RequiresMcRestart @Config.Name("Blast Protection Knockback") @Config.Comment("Fixes the blast protection enchantment not reducing knockback from explosions except at very high levels") - public boolean utBlastProtectionKnockbackToggle = true; + public boolean utBlastProtectionKnockbackToggle = false; @Config.RequiresMcRestart @Config.Name("Depth Mask")