2021-06-05 00:56:46 +02:00
|
|
|
package com.jozufozu.flywheel.event;
|
|
|
|
|
2021-07-28 02:31:58 +02:00
|
|
|
import javax.annotation.Nullable;
|
|
|
|
|
2021-07-28 23:18:24 +02:00
|
|
|
import com.jozufozu.flywheel.backend.Backend;
|
2021-07-28 02:31:58 +02:00
|
|
|
import com.jozufozu.flywheel.backend.state.RenderLayer;
|
2021-07-28 23:18:24 +02:00
|
|
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
2021-07-28 02:31:58 +02:00
|
|
|
|
2021-06-05 00:56:46 +02:00
|
|
|
import net.minecraft.client.renderer.RenderType;
|
2021-07-28 23:18:24 +02:00
|
|
|
import net.minecraft.client.renderer.RenderTypeBuffers;
|
2021-06-05 00:56:46 +02:00
|
|
|
import net.minecraft.client.world.ClientWorld;
|
|
|
|
import net.minecraft.util.math.vector.Matrix4f;
|
|
|
|
import net.minecraftforge.eventbus.api.Event;
|
|
|
|
|
|
|
|
public class RenderLayerEvent extends Event {
|
|
|
|
private final ClientWorld world;
|
|
|
|
public final RenderType type;
|
2021-07-28 23:18:24 +02:00
|
|
|
public final MatrixStack stack;
|
2021-06-05 00:56:46 +02:00
|
|
|
public final Matrix4f viewProjection;
|
2021-07-28 23:18:24 +02:00
|
|
|
public final RenderTypeBuffers buffers;
|
2021-06-05 00:56:46 +02:00
|
|
|
public final double camX;
|
|
|
|
public final double camY;
|
|
|
|
public final double camZ;
|
2021-07-28 02:31:58 +02:00
|
|
|
public final RenderLayer layer;
|
2021-06-05 00:56:46 +02:00
|
|
|
|
2021-07-28 23:18:24 +02:00
|
|
|
public RenderLayerEvent(ClientWorld world, RenderType type, MatrixStack stack, RenderTypeBuffers buffers, double camX, double camY, double camZ) {
|
2021-06-05 00:56:46 +02:00
|
|
|
this.world = world;
|
|
|
|
this.type = type;
|
2021-07-28 23:18:24 +02:00
|
|
|
this.stack = stack;
|
|
|
|
|
|
|
|
viewProjection = stack.last()
|
|
|
|
.pose()
|
|
|
|
.copy();
|
|
|
|
viewProjection.multiplyBackward(Backend.getInstance()
|
|
|
|
.getProjectionMatrix());
|
|
|
|
|
|
|
|
this.buffers = buffers;
|
2021-06-05 00:56:46 +02:00
|
|
|
this.camX = camX;
|
|
|
|
this.camY = camY;
|
|
|
|
this.camZ = camZ;
|
2021-07-28 02:31:58 +02:00
|
|
|
|
|
|
|
this.layer = RenderLayer.fromRenderType(type);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Nullable
|
|
|
|
public RenderLayer getLayer() {
|
|
|
|
return layer;
|
2021-06-05 00:56:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public ClientWorld getWorld() {
|
|
|
|
return world;
|
|
|
|
}
|
|
|
|
|
|
|
|
public RenderType getType() {
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Matrix4f getViewProjection() {
|
|
|
|
return viewProjection;
|
|
|
|
}
|
|
|
|
|
|
|
|
public double getCamX() {
|
|
|
|
return camX;
|
|
|
|
}
|
|
|
|
|
|
|
|
public double getCamY() {
|
|
|
|
return camY;
|
|
|
|
}
|
|
|
|
|
|
|
|
public double getCamZ() {
|
|
|
|
return camZ;
|
|
|
|
}
|
|
|
|
}
|