227 lines
11 KiB
Java
227 lines
11 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* org.joml.Matrix4f
|
|
* org.joml.Matrix4fc
|
|
* org.joml.Quaternionf
|
|
* org.jspecify.annotations.Nullable
|
|
*/
|
|
package net.minecraft.client.renderer;
|
|
|
|
import com.mojang.blaze3d.vertex.PoseStack;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import net.minecraft.client.Minecraft;
|
|
import net.minecraft.client.gui.Font;
|
|
import net.minecraft.client.model.Model;
|
|
import net.minecraft.client.model.geom.ModelPart;
|
|
import net.minecraft.client.renderer.OrderedSubmitNodeCollector;
|
|
import net.minecraft.client.renderer.SubmitNodeCollector;
|
|
import net.minecraft.client.renderer.SubmitNodeStorage;
|
|
import net.minecraft.client.renderer.block.MovingBlockRenderState;
|
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
|
import net.minecraft.client.renderer.block.model.BlockStateModel;
|
|
import net.minecraft.client.renderer.entity.state.EntityRenderState;
|
|
import net.minecraft.client.renderer.feature.CustomFeatureRenderer;
|
|
import net.minecraft.client.renderer.feature.ModelFeatureRenderer;
|
|
import net.minecraft.client.renderer.feature.ModelPartFeatureRenderer;
|
|
import net.minecraft.client.renderer.feature.NameTagFeatureRenderer;
|
|
import net.minecraft.client.renderer.item.ItemStackRenderState;
|
|
import net.minecraft.client.renderer.rendertype.RenderType;
|
|
import net.minecraft.client.renderer.state.CameraRenderState;
|
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
|
import net.minecraft.network.chat.Component;
|
|
import net.minecraft.util.FormattedCharSequence;
|
|
import net.minecraft.world.item.ItemDisplayContext;
|
|
import net.minecraft.world.level.block.state.BlockState;
|
|
import net.minecraft.world.phys.Vec3;
|
|
import org.joml.Matrix4f;
|
|
import org.joml.Matrix4fc;
|
|
import org.joml.Quaternionf;
|
|
import org.jspecify.annotations.Nullable;
|
|
|
|
public class SubmitNodeCollection
|
|
implements OrderedSubmitNodeCollector {
|
|
private final List<SubmitNodeStorage.ShadowSubmit> shadowSubmits = new ArrayList<SubmitNodeStorage.ShadowSubmit>();
|
|
private final List<SubmitNodeStorage.FlameSubmit> flameSubmits = new ArrayList<SubmitNodeStorage.FlameSubmit>();
|
|
private final NameTagFeatureRenderer.Storage nameTagSubmits = new NameTagFeatureRenderer.Storage();
|
|
private final List<SubmitNodeStorage.TextSubmit> textSubmits = new ArrayList<SubmitNodeStorage.TextSubmit>();
|
|
private final List<SubmitNodeStorage.LeashSubmit> leashSubmits = new ArrayList<SubmitNodeStorage.LeashSubmit>();
|
|
private final List<SubmitNodeStorage.BlockSubmit> blockSubmits = new ArrayList<SubmitNodeStorage.BlockSubmit>();
|
|
private final List<SubmitNodeStorage.MovingBlockSubmit> movingBlockSubmits = new ArrayList<SubmitNodeStorage.MovingBlockSubmit>();
|
|
private final List<SubmitNodeStorage.BlockModelSubmit> blockModelSubmits = new ArrayList<SubmitNodeStorage.BlockModelSubmit>();
|
|
private final List<SubmitNodeStorage.ItemSubmit> itemSubmits = new ArrayList<SubmitNodeStorage.ItemSubmit>();
|
|
private final List<SubmitNodeCollector.ParticleGroupRenderer> particleGroupRenderers = new ArrayList<SubmitNodeCollector.ParticleGroupRenderer>();
|
|
private final ModelFeatureRenderer.Storage modelSubmits = new ModelFeatureRenderer.Storage();
|
|
private final ModelPartFeatureRenderer.Storage modelPartSubmits = new ModelPartFeatureRenderer.Storage();
|
|
private final CustomFeatureRenderer.Storage customGeometrySubmits = new CustomFeatureRenderer.Storage();
|
|
private final SubmitNodeStorage submitNodeStorage;
|
|
private boolean wasUsed = false;
|
|
|
|
public SubmitNodeCollection(SubmitNodeStorage submitNodeStorage) {
|
|
this.submitNodeStorage = submitNodeStorage;
|
|
}
|
|
|
|
@Override
|
|
public void submitShadow(PoseStack poseStack, float radius, List<EntityRenderState.ShadowPiece> pieces) {
|
|
this.wasUsed = true;
|
|
PoseStack.Pose pose = poseStack.last();
|
|
this.shadowSubmits.add(new SubmitNodeStorage.ShadowSubmit(new Matrix4f((Matrix4fc)pose.pose()), radius, pieces));
|
|
}
|
|
|
|
@Override
|
|
public void submitNameTag(PoseStack poseStack, @Nullable Vec3 nameTagAttachment, int offset, Component name, boolean seeThrough, int lightCoords, double distanceToCameraSq, CameraRenderState camera) {
|
|
this.wasUsed = true;
|
|
this.nameTagSubmits.add(poseStack, nameTagAttachment, offset, name, seeThrough, lightCoords, distanceToCameraSq, camera);
|
|
}
|
|
|
|
@Override
|
|
public void submitText(PoseStack poseStack, float x, float y, FormattedCharSequence string, boolean dropShadow, Font.DisplayMode displayMode, int lightCoords, int color, int backgroundColor, int outlineColor) {
|
|
this.wasUsed = true;
|
|
this.textSubmits.add(new SubmitNodeStorage.TextSubmit(new Matrix4f((Matrix4fc)poseStack.last().pose()), x, y, string, dropShadow, displayMode, lightCoords, color, backgroundColor, outlineColor));
|
|
}
|
|
|
|
@Override
|
|
public void submitFlame(PoseStack poseStack, EntityRenderState renderState, Quaternionf rotation) {
|
|
this.wasUsed = true;
|
|
this.flameSubmits.add(new SubmitNodeStorage.FlameSubmit(poseStack.last().copy(), renderState, rotation));
|
|
}
|
|
|
|
@Override
|
|
public void submitLeash(PoseStack poseStack, EntityRenderState.LeashState leashState) {
|
|
this.wasUsed = true;
|
|
this.leashSubmits.add(new SubmitNodeStorage.LeashSubmit(new Matrix4f((Matrix4fc)poseStack.last().pose()), leashState));
|
|
}
|
|
|
|
@Override
|
|
public <S> void submitModel(Model<? super S> model, S state, PoseStack poseStack, RenderType renderType, int lightCoords, int overlayCoords, int tintedColor, @Nullable TextureAtlasSprite sprite, int outlineColor, @Nullable ModelFeatureRenderer.CrumblingOverlay crumblingOverlay) {
|
|
this.wasUsed = true;
|
|
SubmitNodeStorage.ModelSubmit<? super S> modelSubmit = new SubmitNodeStorage.ModelSubmit<S>(poseStack.last().copy(), model, state, lightCoords, overlayCoords, tintedColor, sprite, outlineColor, crumblingOverlay);
|
|
this.modelSubmits.add(renderType, modelSubmit);
|
|
}
|
|
|
|
@Override
|
|
public void submitModelPart(ModelPart modelPart, PoseStack poseStack, RenderType renderType, int lightCoords, int overlayCoords, @Nullable TextureAtlasSprite sprite, boolean sheeted, boolean hasFoil, int tintedColor, @Nullable ModelFeatureRenderer.CrumblingOverlay crumblingOverlay, int outlineColor) {
|
|
this.wasUsed = true;
|
|
this.modelPartSubmits.add(renderType, new SubmitNodeStorage.ModelPartSubmit(poseStack.last().copy(), modelPart, lightCoords, overlayCoords, sprite, sheeted, hasFoil, tintedColor, crumblingOverlay, outlineColor));
|
|
}
|
|
|
|
@Override
|
|
public void submitBlock(PoseStack poseStack, BlockState state, int lightCoords, int overlayCoords, int outlineColor) {
|
|
this.wasUsed = true;
|
|
this.blockSubmits.add(new SubmitNodeStorage.BlockSubmit(poseStack.last().copy(), state, lightCoords, overlayCoords, outlineColor));
|
|
Minecraft.getInstance().getModelManager().specialBlockModelRenderer().get().renderByBlock(state.getBlock(), ItemDisplayContext.NONE, poseStack, this.submitNodeStorage, lightCoords, overlayCoords, outlineColor);
|
|
}
|
|
|
|
@Override
|
|
public void submitMovingBlock(PoseStack poseStack, MovingBlockRenderState movingBlockRenderState) {
|
|
this.wasUsed = true;
|
|
this.movingBlockSubmits.add(new SubmitNodeStorage.MovingBlockSubmit(new Matrix4f((Matrix4fc)poseStack.last().pose()), movingBlockRenderState));
|
|
}
|
|
|
|
@Override
|
|
public void submitBlockModel(PoseStack poseStack, RenderType renderType, BlockStateModel model, float r, float g, float b, int lightCoords, int overlayCoords, int outlineColor) {
|
|
this.wasUsed = true;
|
|
this.blockModelSubmits.add(new SubmitNodeStorage.BlockModelSubmit(poseStack.last().copy(), renderType, model, r, g, b, lightCoords, overlayCoords, outlineColor));
|
|
}
|
|
|
|
@Override
|
|
public void submitItem(PoseStack poseStack, ItemDisplayContext displayContext, int lightCoords, int overlayCoords, int outlineColor, int[] tintLayers, List<BakedQuad> quads, RenderType renderType, ItemStackRenderState.FoilType foilType) {
|
|
this.wasUsed = true;
|
|
this.itemSubmits.add(new SubmitNodeStorage.ItemSubmit(poseStack.last().copy(), displayContext, lightCoords, overlayCoords, outlineColor, tintLayers, quads, renderType, foilType));
|
|
}
|
|
|
|
@Override
|
|
public void submitCustomGeometry(PoseStack poseStack, RenderType renderType, SubmitNodeCollector.CustomGeometryRenderer customGeometryRenderer) {
|
|
this.wasUsed = true;
|
|
this.customGeometrySubmits.add(poseStack, renderType, customGeometryRenderer);
|
|
}
|
|
|
|
@Override
|
|
public void submitParticleGroup(SubmitNodeCollector.ParticleGroupRenderer particleGroupRenderer) {
|
|
this.wasUsed = true;
|
|
this.particleGroupRenderers.add(particleGroupRenderer);
|
|
}
|
|
|
|
public List<SubmitNodeStorage.ShadowSubmit> getShadowSubmits() {
|
|
return this.shadowSubmits;
|
|
}
|
|
|
|
public List<SubmitNodeStorage.FlameSubmit> getFlameSubmits() {
|
|
return this.flameSubmits;
|
|
}
|
|
|
|
public NameTagFeatureRenderer.Storage getNameTagSubmits() {
|
|
return this.nameTagSubmits;
|
|
}
|
|
|
|
public List<SubmitNodeStorage.TextSubmit> getTextSubmits() {
|
|
return this.textSubmits;
|
|
}
|
|
|
|
public List<SubmitNodeStorage.LeashSubmit> getLeashSubmits() {
|
|
return this.leashSubmits;
|
|
}
|
|
|
|
public List<SubmitNodeStorage.BlockSubmit> getBlockSubmits() {
|
|
return this.blockSubmits;
|
|
}
|
|
|
|
public List<SubmitNodeStorage.MovingBlockSubmit> getMovingBlockSubmits() {
|
|
return this.movingBlockSubmits;
|
|
}
|
|
|
|
public List<SubmitNodeStorage.BlockModelSubmit> getBlockModelSubmits() {
|
|
return this.blockModelSubmits;
|
|
}
|
|
|
|
public ModelPartFeatureRenderer.Storage getModelPartSubmits() {
|
|
return this.modelPartSubmits;
|
|
}
|
|
|
|
public List<SubmitNodeStorage.ItemSubmit> getItemSubmits() {
|
|
return this.itemSubmits;
|
|
}
|
|
|
|
public List<SubmitNodeCollector.ParticleGroupRenderer> getParticleGroupRenderers() {
|
|
return this.particleGroupRenderers;
|
|
}
|
|
|
|
public ModelFeatureRenderer.Storage getModelSubmits() {
|
|
return this.modelSubmits;
|
|
}
|
|
|
|
public CustomFeatureRenderer.Storage getCustomGeometrySubmits() {
|
|
return this.customGeometrySubmits;
|
|
}
|
|
|
|
public boolean wasUsed() {
|
|
return this.wasUsed;
|
|
}
|
|
|
|
public void clear() {
|
|
this.shadowSubmits.clear();
|
|
this.flameSubmits.clear();
|
|
this.nameTagSubmits.clear();
|
|
this.textSubmits.clear();
|
|
this.leashSubmits.clear();
|
|
this.blockSubmits.clear();
|
|
this.movingBlockSubmits.clear();
|
|
this.blockModelSubmits.clear();
|
|
this.itemSubmits.clear();
|
|
this.particleGroupRenderers.clear();
|
|
this.modelSubmits.clear();
|
|
this.customGeometrySubmits.clear();
|
|
this.modelPartSubmits.clear();
|
|
}
|
|
|
|
public void endFrame() {
|
|
this.modelSubmits.endFrame();
|
|
this.modelPartSubmits.endFrame();
|
|
this.customGeometrySubmits.endFrame();
|
|
this.wasUsed = false;
|
|
}
|
|
}
|
|
|