Skip to content

Commit

Permalink
Merge pull request #357 from IcarussOne/main
Browse files Browse the repository at this point in the history
2nd Batch of Tweaks
  • Loading branch information
ACGaming authored Jan 13, 2024
2 parents a431532 + c7d0a45 commit 8d0c050
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/mixins.bugfixes.blocks.bed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"package": "mod.acgaming.universaltweaks.bugfixes.blocks.bed.mixin",
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"client": ["UTSleepResetsWeatherMixin"]
}
7 changes: 7 additions & 0 deletions src/main/resources/mixins.bugfixes.misc.enchantment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"package": "mod.acgaming.universaltweaks.bugfixes.misc.enchantment.mixin",
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"client": ["UTBlastProtectionMixin"]
}

0 comments on commit 8d0c050

Please sign in to comment.