-
Notifications
You must be signed in to change notification settings - Fork 0
/
GameRendererMixin.java
31 lines (27 loc) · 1.03 KB
/
GameRendererMixin.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package ca.fxco.TinyWorld.mixin.scale;
import net.minecraft.client.Camera;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.world.entity.LivingEntity;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
@Mixin(GameRenderer.class)
public class GameRendererMixin {
@Shadow @Final private Camera mainCamera;
// Fixes the clipping issues https://bugs.mojang.com/browse/MC-267376
@ModifyConstant(
method = "getProjectionMatrix",
constant = @Constant(floatValue = 0.05F)
)
private float tiny$scaleZNearField(float constant) {
if (this.mainCamera.getEntity() instanceof LivingEntity livingEntity) {
double scale = livingEntity.getScale();
if (scale < 1F) {
return (float) (constant * scale);
}
}
return constant;
}
}