top.hendrixshen.magiclib.render.impl.CameraPositionTransformer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of magiclib-1_14_4 Show documentation
Show all versions of magiclib-1_14_4 Show documentation
To beat magic with magic :(
package top.hendrixshen.magiclib.render.impl;
import org.jetbrains.annotations.NotNull;
import top.hendrixshen.magiclib.event.render.impl.RenderContext;
import java.util.Objects;
import net.minecraft.class_1159;
import net.minecraft.class_243;
import net.minecraft.class_310;
import net.minecraft.class_4184;
public class CameraPositionTransformer {
private final class_243 pos;
private RenderContext context;
public CameraPositionTransformer(class_243 pos) {
this.pos = pos;
}
public void apply(@NotNull RenderContext context) {
this.context = context;
class_310 mc = class_310.method_1551();
class_4184 camera = mc.field_1773.method_19418();
class_243 vec3 = this.pos.method_1020(camera.method_19326());
context.pushPose();
context.translate(vec3.method_10216(), vec3.method_10214(), vec3.method_10215());
//#if MC > 11902
//$$ context.mulPoseMatrix(new Matrix4f().rotation(camera.rotationCompat()));
//#else
context.mulPoseMatrix(new class_1159(camera.rotationCompat()));
//#endif
}
public void restore() {
Objects.requireNonNull(this.context);
this.context.popPose();
this.context = null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy