generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some nametag related settings & text strikethrough
- Loading branch information
1 parent
0e1f910
commit 2cef725
Showing
6 changed files
with
83 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/main/java/me/mixces/animatium/mixins/MixinEntityRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package me.mixces.animatium.mixins; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import me.mixces.animatium.config.AnimatiumConfig; | ||
import net.minecraft.client.option.GameOptions; | ||
import net.minecraft.client.render.entity.EntityRenderer; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.ModifyArg; | ||
|
||
@Mixin(EntityRenderer.class) | ||
public abstract class MixinEntityRenderer { | ||
@WrapOperation(method = "renderLabelIfPresent", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/GameOptions;getTextBackgroundOpacity(F)F")) | ||
private float hideNameTagBackground(GameOptions instance, float fallback, Operation<Float> original) { | ||
if (AnimatiumConfig.hideNameTagBackground) { | ||
return 0F; | ||
} else { | ||
return original.call(instance, fallback); | ||
} | ||
} | ||
|
||
@ModifyArg(method = "renderLabelIfPresent", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/TextRenderer;draw(Lnet/minecraft/text/Text;FFIZLorg/joml/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/font/TextRenderer$TextLayerType;II)I"), index = 4) | ||
private boolean applyTextShadowToNametag(boolean shadow) { | ||
if (AnimatiumConfig.applyTextShadowToNametag) { | ||
return true; | ||
} else { | ||
return shadow; | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/me/mixces/animatium/mixins/MixinTextRendererDrawer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package me.mixces.animatium.mixins; | ||
|
||
import me.mixces.animatium.config.AnimatiumConfig; | ||
import net.minecraft.client.font.TextRenderer; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.ModifyArg; | ||
|
||
@Mixin(TextRenderer.Drawer.class) | ||
public abstract class MixinTextRendererDrawer { | ||
@Unique | ||
private static final float animatium$strikethroughOffset = 0.5F; | ||
|
||
@ModifyArg(method = "accept", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/BakedGlyph$Rectangle;<init>(FFFFFIIF)V", ordinal = 0), index = 1) | ||
private float fixTextStrikethroughStyle$minY(float minY) { | ||
if (AnimatiumConfig.fixTextStrikethroughStyle) { | ||
return minY - animatium$strikethroughOffset; | ||
} else { | ||
return minY; | ||
} | ||
} | ||
|
||
@ModifyArg(method = "accept", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/BakedGlyph$Rectangle;<init>(FFFFFIIF)V", ordinal = 0), index = 3) | ||
private float fixTextStrikethroughStyle$maxY(float maxY) { | ||
if (AnimatiumConfig.fixTextStrikethroughStyle) { | ||
return maxY - animatium$strikethroughOffset; | ||
} else { | ||
return maxY; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
accessWidener v2 named | ||
accessible class net/minecraft/client/gui/hud/InGameHud$HeartType | ||
accessible class net/minecraft/client/gui/hud/InGameHud$HeartType | ||
accessible class net/minecraft/client/font/TextRenderer$Drawer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters