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/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 5046965c..ef4f48be 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 @@ -283,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 = false; + @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 b421adca..9d997035 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java @@ -322,6 +322,10 @@ 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.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.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 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