Skip to content
This repository has been archived by the owner on Sep 15, 2024. It is now read-only.

Commit

Permalink
totem features
Browse files Browse the repository at this point in the history
  • Loading branch information
MicrocontrollersDev committed May 28, 2024
1 parent 3a58d64 commit 2a11dee
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 41 deletions.
44 changes: 11 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,6 @@ Contributing software and their licenses can be found at [OPEN_SOURCE_SOFTWARE.m
- Container Texture Opacity
- Container Scale

#### Tab List

- Tab Widget Color
- Move Tab List Down
- Move Tab List Below Bossbars
- Show Numerical Ping
- Scale Numerical Ping
- Hide Fake Ping

#### Screen Shake

- Disable Screen Bobbing
Expand All @@ -38,6 +29,10 @@ Contributing software and their licenses can be found at [OPEN_SOURCE_SOFTWARE.m
- Disable Hand Damage Tilt
- Disable Hand View Sway

#### Tab Background (1.20.4 and prior only)

- Tab Background Opacity

#### Suffocation Overlay

- Suffocation Overlay Brightness
Expand All @@ -50,7 +45,14 @@ Contributing software and their licenses can be found at [OPEN_SOURCE_SOFTWARE.m
- Shield Opacity
- Color Shield Cooldown

#### Totem

- Disable Totem Overlay
- Disable Totem Particles
- Totem Scale

#### Water

- Remove Water Overlay
- Remove Underwater FOV Change

Expand All @@ -70,30 +72,6 @@ Contributing software and their licenses can be found at [OPEN_SOURCE_SOFTWARE.m
- Hide Scoreboard in Debug
- Classic Debug Style

#### Titles

- Disable Titles
- Title Scale
- Automatically Scale Titles
- Title Opacity

### Crosshair

#### General

- Hide in Containers
- Show in Third Person
- Always Show in Spectator
- Remove Blending
- Crosshair Opacity

#### Debug

- Ignore Debug Crosshair
- Always Use Debug Crosshair
- Fix Debug Crosshair Attack Indicator
- Debug Crosshair Size

### Effects

#### Items
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public class OverlayTweaksConfig {
@SerialEntry public Color shieldColorMid = new Color(0.75F, 0.37F, 0.2F);
@SerialEntry public Color shieldColorLow = new Color(1F, 1F, 0F);
@SerialEntry public boolean disableTotemOverlay = false;
@SerialEntry public boolean disableTotemParticles = false;
@SerialEntry public float totemScale = 1.0F;
@SerialEntry public boolean removeWaterOverlay = true;
@SerialEntry public boolean removeWaterFov = true;
@SerialEntry public boolean removeFireOverlay = true;
Expand Down Expand Up @@ -254,10 +256,24 @@ public static Screen configScreen(Screen parent) {
.name(Text.literal("Totem"))
.option(Option.createBuilder(boolean.class)
.name(Text.literal("Disable Totem Overlay"))
.description(OptionDescription.of(Text.of("Removes the totem overlay from your screen.")))
.description(OptionDescription.of(Text.of("Removes the totem overlay animation entirely.")))
.binding(defaults.disableTotemOverlay, () -> config.disableTotemOverlay, newVal -> config.disableTotemOverlay = newVal)
.controller(TickBoxControllerBuilder::create)
.build())
.option(Option.createBuilder(boolean.class)
.name(Text.literal("Disable Totem Particles"))
.description(OptionDescription.of(Text.of("Removes the totem particles when a totem is used.")))
.binding(defaults.disableTotemParticles, () -> config.disableTotemParticles, newVal -> config.disableTotemParticles = newVal)
.controller(TickBoxControllerBuilder::create)
.build())
.option(Option.createBuilder(float.class)
.name(Text.literal("Totem Scale"))
.description(OptionDescription.of(Text.of("The scale at which to render the totem overlay animation.")))
.binding(1F, () -> config.totemScale, newVal -> config.totemScale = newVal)
.controller(opt -> FloatSliderControllerBuilder.create(opt)
.range(0.1F, 2F)
.step(0.1F))
.build())
.build())

// Water
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,24 @@
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.item.FilledMapItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import org.jetbrains.annotations.Nullable;
import org.joml.Matrix4f;
import org.joml.Matrix4fStack;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.*;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;

@Mixin(value = GameRenderer.class, priority = 1001)
public class GameRendererMixin {
@Shadow private int floatingItemTimeLeft;

@Shadow @Nullable private ItemStack floatingItem;

@ModifyExpressionValue(method = "getFov", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;lerp(DDD)D"))
private double removeWaterFov(double original) {
if (OverlayTweaksConfig.CONFIG.instance().removeWaterFov) return 1.0;
Expand Down Expand Up @@ -85,7 +87,14 @@ private boolean disableScreenDamageTilt(GameRenderer instance, MatrixStack matri

@Inject(method = "renderFloatingItem", at = @At("HEAD"))
private void changeTotemTime(int scaledWidth, int scaledHeight, float tickDelta, CallbackInfo ci) {
if (OverlayTweaksConfig.CONFIG.instance().disableTotemOverlay) this.floatingItemTimeLeft = 0;
if (OverlayTweaksConfig.CONFIG.instance().disableTotemOverlay && this.floatingItem != null && this.floatingItem.isOf(Items.TOTEM_OF_UNDYING)) this.floatingItemTimeLeft = 0;
}

@ModifyArgs(method = "renderFloatingItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;scale(FFF)V"))
private void changeTotemScale(Args args) {
args.set(0, (float) args.get(0) * OverlayTweaksConfig.CONFIG.instance().totemScale);
args.set(1, (float) args.get(1) * OverlayTweaksConfig.CONFIG.instance().totemScale);
args.set(2, (float) args.get(2) * OverlayTweaksConfig.CONFIG.instance().totemScale);
}

/*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package dev.microcontrollers.overlaytweaks.mixin;

import dev.microcontrollers.overlaytweaks.config.OverlayTweaksConfig;
import net.minecraft.client.particle.AnimatedParticle;
import net.minecraft.client.particle.SpriteProvider;
import net.minecraft.client.particle.TotemParticle;
import net.minecraft.client.world.ClientWorld;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(TotemParticle.class)
public class TotemParticleMixin extends AnimatedParticle {
protected TotemParticleMixin(ClientWorld world, double x, double y, double z, SpriteProvider spriteProvider, float upwardsAcceleration) {
super(world, x, y, z, spriteProvider, upwardsAcceleration);
}

@Inject(method = "<init>(Lnet/minecraft/client/world/ClientWorld;DDDDDDLnet/minecraft/client/particle/SpriteProvider;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/particle/TotemParticle;setSpriteForAge(Lnet/minecraft/client/particle/SpriteProvider;)V"))
private void removeTotemParticleAge(ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ, SpriteProvider spriteProvider, CallbackInfo ci) {
if (OverlayTweaksConfig.CONFIG.instance().disableTotemParticles) this.scale = 0;
}

}
3 changes: 1 addition & 2 deletions src/main/resources/overlaytweaks.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@
"PotionItemMixin",
"ScreenMixin",
"SubtitlesHudMixin",
"TotemParticleMixin",
"WorldRendererMixin",
"screenopacity.AbstractFurnaceScreenMixin",
"screenopacity.AnvilScreenMixin",
"screenopacity.BeaconScreenMixin",
"screenopacity.BrewingStandScreenMixin",
"screenopacity.CartographyTableScreenMixin",
//#if MC >= 1.20.4
"screenopacity.CrafterScreenMixin",
//#endif
"screenopacity.CraftingScreenMixin",
"screenopacity.CreativeInventoryScreenMixin",
"screenopacity.EnchantmentScreenMixin",
Expand Down

0 comments on commit 2a11dee

Please sign in to comment.