-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Improve mixin compatibility * Review and update mixins where needed * Use MixinExtras mixins where beneficial * Restore the outline "feature"
- Loading branch information
1 parent
e9be937
commit 975fc31
Showing
7 changed files
with
95 additions
and
65 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
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
31 changes: 18 additions & 13 deletions
31
src/main/java/com/terraformersmc/vistas/mixin/SplashTextRendererMixin.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 |
---|---|---|
@@ -1,32 +1,37 @@ | ||
package com.terraformersmc.vistas.mixin; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import com.terraformersmc.vistas.panorama.LogoControl; | ||
import com.terraformersmc.vistas.panorama.Panorama; | ||
import com.terraformersmc.vistas.title.VistasTitle; | ||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
import net.minecraft.client.font.TextRenderer; | ||
import net.minecraft.client.gui.DrawContext; | ||
import net.minecraft.client.gui.screen.SplashTextRenderer; | ||
import net.minecraft.client.util.math.MatrixStack; | ||
import net.minecraft.util.math.RotationAxis; | ||
import org.joml.Quaternionf; | ||
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.ModifyArg; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Environment(EnvType.CLIENT) | ||
@Mixin(SplashTextRenderer.class) | ||
public abstract class SplashTextRendererMixin { | ||
@ModifyArg(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/RotationAxis;rotationDegrees(F)Lorg/joml/Quaternionf;")) | ||
private float vistas$render$changeAngle(float in) { | ||
return (float) VistasTitle.CURRENT.getValue().getLogoControl().getSplashRot(); | ||
} | ||
|
||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;multiply(Lorg/joml/Quaternionf;)V", shift = At.Shift.BEFORE)) | ||
private void vistas$render(DrawContext context, int screenWidth, TextRenderer textRenderer, int alpha, CallbackInfo ci) { | ||
@WrapOperation( | ||
method = "render", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/client/util/math/MatrixStack;multiply(Lorg/joml/Quaternionf;)V" | ||
) | ||
) | ||
@SuppressWarnings("unused") | ||
private void vistas$render(MatrixStack instance, Quaternionf quaternion, Operation<Void> operation) { | ||
Panorama panorama = VistasTitle.CURRENT.getValue(); | ||
LogoControl logo = panorama.getLogoControl(); | ||
|
||
context.getMatrices().translate(logo.getSplashX(), logo.getSplashY(), 0.0D); | ||
float rotation = (float) VistasTitle.CURRENT.getValue().getLogoControl().getSplashRot(); | ||
|
||
instance.translate(logo.getSplashX(), logo.getSplashY(), 0.0D); | ||
operation.call(instance, RotationAxis.POSITIVE_Z.rotationDegrees(rotation)); | ||
} | ||
} |
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
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