Skip to content

Commit

Permalink
Implement riding exhaustion tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
ACGaming committed Feb 6, 2024
1 parent 7ba49ad commit 89b5c1f
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ All changes are toggleable via config files.
* **Remove Realms Button:** Removes the redundant Minecraft Realms button from the main menu
* **Remove Recipe Book:** Removes the recipe book button from GUIs
* **Remove Snooper:** Forcefully turns off the snooper and hides the snooper settings button from the options menu
* **Riding Exhaustion:** Enables depleting saturation when riding mounts
* **Sapling Behavior:** Allows customization of sapling behavior while utilizing an optimized method
* **Sea Level:** Sets the default height of the overworld's sea level
* **Selected Item Tooltip Height:** Sets the Y value of the selected item tooltip, displayed when held items are changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,11 @@ public static class EntitiesCategory
@Config.RangeDouble(min = 0.0D, max = 1.0D)
public double utRabbitToastChance = 0.0D;

@Config.RequiresMcRestart
@Config.Name("Riding Exhaustion")
@Config.Comment("Enables depleting saturation when riding mounts")
public boolean utRidingExhaustionToggle = false;

@Config.RequiresMcRestart
@Config.Name("Soulbound Vexes")
@Config.Comment("Summoned vexes will also die when their summoner is killed")
Expand Down Expand Up @@ -1163,7 +1168,7 @@ public static class MiscCategory
@Config.Name("Default Difficulty")
@Config.Comment("Sets the default difficulty for newly generated worlds")
public EnumDifficulty utDefaultDifficulty = EnumDifficulty.NORMAL;

@Config.RequiresMcRestart
@Config.Name("Disable Advancements")
@Config.Comment("Prevents the advancement system from loading entirely")
Expand Down Expand Up @@ -1384,7 +1389,7 @@ public static class LightningCategory
@Config.Name("No Lightning Flash")
@Config.Comment("Disables the flashing of skybox and ground brightness on lightning bolt strikes")
public boolean utLightningFlashToggle = false;

@Config.RequiresMcRestart
@Config.Name("No Lightning Item Destruction")
@Config.Comment("Prevents lightning bolts from destroying items")
Expand Down Expand Up @@ -1636,17 +1641,17 @@ public static class PerformanceCategory
"May have side effects such as slower chunk generation"
})
public boolean utWorldLoadingToggle = false;

@Config.RequiresMcRestart
@Config.Name("Mute Advancement Errors")
@Config.Comment("Silences advancement errors")
public boolean utAdvancementCheckToggle = false;

@Config.RequiresMcRestart
@Config.Name("Mute Ore Dictionary Errors")
@Config.Comment("Silences ore dictionary errors")
public boolean utOreDictionaryCheckToggle = false;

@Config.RequiresMcRestart
@Config.Name("Mute Texture Map Errors")
@Config.Comment("Silences texture map errors")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ public List<String> getMixinConfigs()
configs.add("mixins.tweaks.entities.damage.velocity.json");
configs.add("mixins.tweaks.entities.despawning.json");
configs.add("mixins.tweaks.entities.loot.json");
configs.add("mixins.tweaks.entities.saturation.json");
configs.add("mixins.tweaks.entities.spawning.caps.json");
configs.add("mixins.tweaks.entities.spawning.creeper.confetti.json");
configs.add("mixins.tweaks.entities.spawning.golem.json");
Expand Down Expand Up @@ -444,6 +445,8 @@ public boolean shouldMixinConfigQueue(String mixinConfig)
return UTConfigTweaks.ENTITIES.utMobDespawnToggle;
case "mixins.tweaks.entities.loot.json":
return UTConfigTweaks.ENTITIES.utCreeperMusicDiscsToggle;
case "mixins.tweaks.entities.saturation.json":
return UTConfigTweaks.ENTITIES.utRidingExhaustionToggle;
case "mixins.tweaks.entities.spawning.caps.json":
return UTConfigTweaks.ENTITIES.SPAWN_CAPS.utSpawnCapsToggle;
case "mixins.tweaks.entities.spawning.creeper.confetti.json":
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package mod.acgaming.universaltweaks.tweaks.entities.saturation.mixin;

import net.minecraft.entity.player.EntityPlayer;

import mod.acgaming.universaltweaks.config.UTConfigTweaks;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(EntityPlayer.class)
public class UTRidingExhaustionMixin
{
@Redirect(method = "addMovementStat", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/EntityPlayer;isRiding()Z"))
public boolean utRidingExhaustion(EntityPlayer player)
{
return player.isRiding() || UTConfigTweaks.ENTITIES.utRidingExhaustionToggle;
}
}
7 changes: 7 additions & 0 deletions src/main/resources/mixins.tweaks.entities.saturation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"package": "mod.acgaming.universaltweaks.tweaks.entities.saturation.mixin",
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": ["UTRidingExhaustionMixin"]
}

0 comments on commit 89b5c1f

Please sign in to comment.