| 1 | package net.minecraft.client.renderer;
|
| 2 |
|
| 3 | import com.mojang.blaze3d.systems.RenderSystem;
|
| 4 | import com.mojang.blaze3d.vertex.PoseStack;
|
| 5 | import java.util.List;
|
| 6 | import net.fabricmc.api.EnvType;
|
| 7 | import net.fabricmc.api.Environment;
|
| 8 | import net.minecraft.client.Minecraft;
|
| 9 | import net.minecraft.client.gui.Font;
|
| 10 | import net.minecraft.client.model.Model;
|
| 11 | import net.minecraft.client.renderer.block.BlockModelRenderState;
|
| 12 | import net.minecraft.client.renderer.block.MovingBlockRenderState;
|
| 13 | import net.minecraft.client.renderer.block.dispatch.BlockStateModel;
|
| 14 | import net.minecraft.client.renderer.block.dispatch.BlockStateModelPart;
|
| 15 | import net.minecraft.client.renderer.entity.state.EntityRenderState;
|
| 16 | import net.minecraft.client.renderer.feature.BlockModelFeatureRenderer;
|
| 17 | import net.minecraft.client.renderer.feature.CustomFeatureRenderer;
|
| 18 | import net.minecraft.client.renderer.feature.FlameFeatureRenderer;
|
| 19 | import net.minecraft.client.renderer.feature.GizmoFeatureRenderer;
|
| 20 | import net.minecraft.client.renderer.feature.ItemFeatureRenderer;
|
| 21 | import net.minecraft.client.renderer.feature.LeashFeatureRenderer;
|
| 22 | import net.minecraft.client.renderer.feature.ModelFeatureRenderer;
|
| 23 | import net.minecraft.client.renderer.feature.MovingBlockFeatureRenderer;
|
| 24 | import net.minecraft.client.renderer.feature.QuadParticleFeatureRenderer;
|
| 25 | import net.minecraft.client.renderer.feature.ShadowFeatureRenderer;
|
| 26 | import net.minecraft.client.renderer.feature.ShapeOutlineFeatureRenderer;
|
| 27 | import net.minecraft.client.renderer.feature.TextFeatureRenderer;
|
| 28 | import net.minecraft.client.renderer.feature.TextFeatureRenderer.Content.StandaloneBackground;
|
| 29 | import net.minecraft.client.renderer.feature.TextFeatureRenderer.Content.Text;
|
| 30 | import net.minecraft.client.renderer.feature.phase.FeatureRenderPhase;
|
| 31 | import net.minecraft.client.renderer.feature.phase.SimpleFeatureRenderPhase;
|
| 32 | import net.minecraft.client.renderer.feature.phase.TranslucentFeatureRenderPhase;
|
| 33 | import net.minecraft.client.renderer.feature.submit.TranslucentSubmit;
|
| 34 | import net.minecraft.client.renderer.gizmos.DrawableGizmoPrimitives;
|
| 35 | import net.minecraft.client.renderer.item.ItemStackRenderState;
|
| 36 | import net.minecraft.client.renderer.rendertype.RenderType;
|
| 37 | import net.minecraft.client.renderer.rendertype.RenderTypes;
|
| 38 | import net.minecraft.client.renderer.state.level.CameraRenderState;
|
| 39 | import net.minecraft.client.renderer.state.level.QuadParticleRenderState;
|
| 40 | import net.minecraft.client.renderer.texture.OverlayTexture;
|
| 41 | import net.minecraft.client.renderer.texture.UvMapping;
|
| 42 | import net.minecraft.client.resources.model.ModelBakery;
|
| 43 | import net.minecraft.client.resources.model.geometry.ItemQuads;
|
| 44 | import net.minecraft.network.chat.Component;
|
| 45 | import net.minecraft.util.ARGB;
|
| 46 | import net.minecraft.util.FormattedCharSequence;
|
| 47 | import net.minecraft.util.LightCoordsUtil;
|
| 48 | import net.minecraft.world.item.ItemDisplayContext;
|
| 49 | import net.minecraft.world.phys.Vec3;
|
| 50 | import net.minecraft.world.phys.shapes.VoxelShape;
|
| 51 | import org.joml.Matrix4f;
|
| 52 | import org.joml.Quaternionf;
|
| 53 | import org.jspecify.annotations.Nullable;
|
| 54 |
|
| 55 | @Environment(EnvType.CLIENT)
|
| 56 | public class SubmitNodeCollection implements OrderedSubmitNodeCollector {
|
| 57 | public final SimpleFeatureRenderPhase solid = new SimpleFeatureRenderPhase();
|
| 58 | public final SimpleFeatureRenderPhase waterMask = new SimpleFeatureRenderPhase();
|
| 59 | public final SimpleFeatureRenderPhase outline = new SimpleFeatureRenderPhase();
|
| 60 | public final SimpleFeatureRenderPhase alwaysOnTopGizmos = new SimpleFeatureRenderPhase();
|
| 61 | public final TranslucentFeatureRenderPhase seeThrough;
|
| 62 | public final SimpleFeatureRenderPhase oitTranslucent = new SimpleFeatureRenderPhase();
|
| 63 | public final SimpleFeatureRenderPhase shadows;
|
| 64 | public final SimpleFeatureRenderPhase nameTags;
|
| 65 | public final SimpleFeatureRenderPhase texts;
|
| 66 | public final SimpleFeatureRenderPhase shapeOutlines;
|
| 67 | public final FeatureRenderPhase<? super TranslucentSubmit> translucentBlocksAndItems;
|
| 68 | public final FeatureRenderPhase<? super TranslucentSubmit> translucentModels;
|
| 69 | public final SimpleFeatureRenderPhase translucentCustomGeometry;
|
| 70 | public final SimpleFeatureRenderPhase breakingOverlay;
|
| 71 | public final SimpleFeatureRenderPhase afterTerrain;
|
| 72 | public final SimpleFeatureRenderPhase translucentGizmos;
|
| 73 | private final List<FeatureRenderPhase<?>> allPhases;
|
| 74 |
|
| 75 | public SubmitNodeCollection(final boolean useImprovedTransparency, final TranslucentFeatureRenderPhase seeThrough) {
|
| 76 | this.seeThrough = seeThrough;
|
| 77 | if (useImprovedTransparency) {
|
| 78 | this.shadows = this.oitTranslucent;
|
| 79 | this.nameTags = this.oitTranslucent;
|
| 80 | this.texts = this.oitTranslucent;
|
| 81 | this.shapeOutlines = this.oitTranslucent;
|
| 82 | this.translucentBlocksAndItems = this.oitTranslucent;
|
| 83 | this.translucentModels = this.oitTranslucent;
|
| 84 | this.translucentCustomGeometry = this.oitTranslucent;
|
| 85 | this.breakingOverlay = this.oitTranslucent;
|
| 86 | this.afterTerrain = this.oitTranslucent;
|
| 87 | this.translucentGizmos = this.oitTranslucent;
|
| 88 | this.allPhases = List.of(this.solid, this.waterMask, this.outline, this.alwaysOnTopGizmos, this.oitTranslucent);
|
| 89 | } else {
|
| 90 | this.shadows = new SimpleFeatureRenderPhase();
|
| 91 | this.nameTags = new SimpleFeatureRenderPhase();
|
| 92 | this.texts = new SimpleFeatureRenderPhase();
|
| 93 | this.shapeOutlines = new SimpleFeatureRenderPhase();
|
| 94 | this.translucentBlocksAndItems = new TranslucentFeatureRenderPhase();
|
| 95 | this.translucentModels = new TranslucentFeatureRenderPhase();
|
| 96 | this.translucentCustomGeometry = new SimpleFeatureRenderPhase();
|
| 97 | this.breakingOverlay = new SimpleFeatureRenderPhase();
|
| 98 | this.afterTerrain = new SimpleFeatureRenderPhase();
|
| 99 | this.translucentGizmos = new SimpleFeatureRenderPhase();
|
| 100 | this.allPhases = List.of(
|
| 101 | this.solid,
|
| 102 | this.shadows,
|
| 103 | this.nameTags,
|
| 104 | this.texts,
|
| 105 | this.shapeOutlines,
|
| 106 | this.translucentBlocksAndItems,
|
| 107 | this.translucentModels,
|
| 108 | this.translucentCustomGeometry,
|
| 109 | this.translucentGizmos,
|
| 110 | this.breakingOverlay,
|
| 111 | this.waterMask,
|
| 112 | this.afterTerrain,
|
| 113 | this.alwaysOnTopGizmos,
|
| 114 | this.outline
|
| 115 | );
|
| 116 | }
|
| 117 | }
|
| 118 |
|
| 119 | @Override
|
| 120 | public void submitShadow(final PoseStack poseStack, final float radius, final List<EntityRenderState.ShadowPiece> pieces) {
|
| 121 | PoseStack.Pose pose = poseStack.last();
|
| 122 | this.shadows.submit(new ShadowFeatureRenderer.Submit(new Matrix4f(pose.pose()), radius, pieces));
|
| 123 | }
|
| 124 |
|
| 125 | @Override
|
| 126 | public void submitNameTag(
|
| 127 | final PoseStack poseStack,
|
| 128 | final @Nullable Vec3 nameTagAttachment,
|
| 129 | final int offset,
|
| 130 | final Component name,
|
| 131 | final boolean seeThrough,
|
| 132 | final int lightCoords,
|
| 133 | final CameraRenderState camera
|
| 134 | ) {
|
| 135 | if (nameTagAttachment != null) {
|
| 136 | Minecraft minecraft = Minecraft.getInstance();
|
| 137 | poseStack.pushPose();
|
| 138 | poseStack.translate(nameTagAttachment.x, nameTagAttachment.y + 0.5, nameTagAttachment.z);
|
| 139 | poseStack.rotate(camera.orientation);
|
| 140 | poseStack.scale(0.025F, -0.025F, 0.025F);
|
| 141 | Matrix4f pose = new Matrix4f(poseStack.last().pose());
|
| 142 | float x = -minecraft.font.width(name) / 2.0F;
|
| 143 | float backgroundAlpha = minecraft.gameRenderer.gameRenderState().optionsRenderState.getBackgroundOpacity(0.25F);
|
| 144 | int backgroundColor = ARGB.color(backgroundAlpha, -16777216);
|
| 145 | float textAlpha = Math.max((backgroundAlpha + 0.75F) * 0.5F, 0.5F);
|
| 146 | int textColor = ARGB.color(textAlpha, -1);
|
| 147 | FormattedCharSequence visualOrderName = name.getVisualOrderText();
|
| 148 | if (seeThrough) {
|
| 149 | this.submitNameTagPart(nameTag(pose, x, offset, visualOrderName, LightCoordsUtil.lightCoordsWithEmission(lightCoords, 2), -1, 0, Font.DisplayMode.NORMAL));
|
| 150 | this.seeThrough.submit(nameTag(pose, x, offset, visualOrderName, lightCoords, textColor, backgroundColor, Font.DisplayMode.SEE_THROUGH));
|
| 151 | } else {
|
| 152 | this.submitNameTagPart(nameTag(pose, x, offset, visualOrderName, lightCoords, textColor, backgroundColor, Font.DisplayMode.NORMAL));
|
| 153 | }
|
| 154 |
|
| 155 | poseStack.popPose();
|
| 156 | }
|
| 157 | }
|
| 158 |
|
| 159 | private static TextFeatureRenderer.Submit nameTag(
|
| 160 | final Matrix4f pose,
|
| 161 | final float x,
|
| 162 | final float y,
|
| 163 | final FormattedCharSequence name,
|
| 164 | final int lightCoords,
|
| 165 | final int color,
|
| 166 | final int backgroundColor,
|
| 167 | final Font.DisplayMode displayMode
|
| 168 | ) {
|
| 169 | TextFeatureRenderer.Content content = new Text(x, y, name, false, color, backgroundColor, 0);
|
| 170 | return new TextFeatureRenderer.Submit(pose, displayMode, lightCoords, content);
|
| 171 | }
|
| 172 |
|
| 173 | private void submitNameTagPart(final TextFeatureRenderer.Submit nameTag) {
|
| 174 | if (canRenderAsSolid(nameTag.content())) {
|
| 175 | this.solid.submit(nameTag);
|
| 176 | } else {
|
| 177 | this.nameTags.submit(nameTag);
|
| 178 | }
|
| 179 | }
|
| 180 |
|
| 181 | private static boolean canRenderAsSolid(final TextFeatureRenderer.Content content) {
|
| 182 | return content instanceof Text text && ARGB.alpha(text.color()) == 255 && ARGB.alpha(text.backgroundColor()) == 0 && RenderSystem.isRenderingLevel;
|
| 183 | }
|
| 184 |
|
| 185 | @Override
|
| 186 | public void submitText(
|
| 187 | final PoseStack poseStack,
|
| 188 | final float x,
|
| 189 | final float y,
|
| 190 | final FormattedCharSequence string,
|
| 191 | final boolean dropShadow,
|
| 192 | final Font.DisplayMode displayMode,
|
| 193 | final int lightCoords,
|
| 194 | final int color,
|
| 195 | final int backgroundColor,
|
| 196 | final int outlineColor
|
| 197 | ) {
|
| 198 | this.submitTextPart(poseStack, displayMode, lightCoords, new Text(x, y, string, dropShadow, color, backgroundColor, outlineColor));
|
| 199 | }
|
| 200 |
|
| 201 | @Override
|
| 202 | public void submitTextBackground(
|
| 203 | final PoseStack poseStack,
|
| 204 | final float x0,
|
| 205 | final float y0,
|
| 206 | final float x1,
|
| 207 | final float y1,
|
| 208 | final int color,
|
| 209 | final Font.DisplayMode displayMode,
|
| 210 | final int lightCoords
|
| 211 | ) {
|
| 212 | this.submitTextPart(poseStack, displayMode, lightCoords, new StandaloneBackground(x0, y0, x1, y1, color));
|
| 213 | }
|
| 214 |
|
| 215 | private void submitTextPart(final PoseStack poseStack, final Font.DisplayMode displayMode, final int lightCoords, final TextFeatureRenderer.Content content) {
|
| 216 | TextFeatureRenderer.Submit submit = new TextFeatureRenderer.Submit(new Matrix4f(poseStack.last().pose()), displayMode, lightCoords, content);
|
| 217 | if (displayMode == Font.DisplayMode.SEE_THROUGH) {
|
| 218 | this.seeThrough.submit(submit);
|
| 219 | } else if (canRenderAsSolid(content)) {
|
| 220 | this.solid.submit(submit);
|
| 221 | } else {
|
| 222 | this.texts.submit(submit);
|
| 223 | }
|
| 224 | }
|
| 225 |
|
| 226 | @Override
|
| 227 | public void submitFlame(final PoseStack poseStack, final EntityRenderState renderState, final Quaternionf rotation) {
|
| 228 | this.solid.submit(new FlameFeatureRenderer.Submit(poseStack.last().copy(), renderState, rotation));
|
| 229 | }
|
| 230 |
|
| 231 | @Override
|
| 232 | public void submitLeash(final PoseStack poseStack, final EntityRenderState.LeashState leashState) {
|
| 233 | this.solid.submit(new LeashFeatureRenderer.Submit(new Matrix4f(poseStack.last().pose()), leashState));
|
| 234 | }
|
| 235 |
|
| 236 | @Override
|
| 237 | public <S> void submitModel(
|
| 238 | final Model<? super S> model,
|
| 239 | final S state,
|
| 240 | final PoseStack poseStack,
|
| 241 | final RenderType renderType,
|
| 242 | final int lightCoords,
|
| 243 | final int overlayCoords,
|
| 244 | final int tintedColor,
|
| 245 | final @Nullable UvMapping uvMapping,
|
| 246 | final int outlineColor
|
| 247 | ) {
|
| 248 | PoseStack.Pose pose = poseStack.last().copy();
|
| 249 | if (!renderType.isOutline()) {
|
| 250 | ModelFeatureRenderer.Submit<S> submit = new ModelFeatureRenderer.Submit<>(
|
| 251 | renderType, pose, model, state, lightCoords, overlayCoords, tintedColor, uvMapping, null
|
| 252 | );
|
| 253 | if (renderType == RenderTypes.waterMask()) {
|
| 254 | this.waterMask.submit(submit);
|
| 255 | } else if (!renderType.forceSolidModelPhase() && renderType.hasBlending()) {
|
| 256 | this.translucentModels.submit(submit);
|
| 257 | } else {
|
| 258 | this.solid.submit(submit);
|
| 259 | }
|
| 260 | }
|
| 261 |
|
| 262 | if (outlineColor != 0) {
|
| 263 | RenderType outlineRenderType = getOutlineRenderType(renderType);
|
| 264 | if (outlineRenderType != null) {
|
| 265 | this.outline
|
| 266 | .submit(new ModelFeatureRenderer.Submit<>(outlineRenderType, pose, model, state, 15728880, OverlayTexture.NO_OVERLAY, outlineColor, uvMapping, null));
|
| 267 | }
|
| 268 | }
|
| 269 | }
|
| 270 |
|
| 271 | @Override
|
| 272 | public <S> void submitCrumblingOverlay(
|
| 273 | final Model<? super S> model,
|
| 274 | final S state,
|
| 275 | final PoseStack poseStack,
|
| 276 | final RenderType renderType,
|
| 277 | final int lightCoords,
|
| 278 | final int overlayCoords,
|
| 279 | final int tintedColor,
|
| 280 | final ModelFeatureRenderer.CrumblingOverlay crumblingOverlay
|
| 281 | ) {
|
| 282 | if (renderType.affectsCrumbling()) {
|
| 283 | boolean translucent = renderType.hasBlending();
|
| 284 | List<RenderType> destroyTypes;
|
| 285 | if (Minecraft.getInstance().gameRenderer.useImprovedTransparency() && translucent) {
|
| 286 | destroyTypes = ModelBakery.DESTROY_TYPES_OIT;
|
| 287 | } else {
|
| 288 | destroyTypes = ModelBakery.DESTROY_TYPES;
|
| 289 | }
|
| 290 |
|
| 291 | RenderType crumblingRenderType = destroyTypes.get(crumblingOverlay.progress());
|
| 292 | SimpleFeatureRenderPhase targetPhase = translucent ? this.breakingOverlay : this.solid;
|
| 293 | targetPhase.submit(
|
| 294 | new ModelFeatureRenderer.Submit<>(
|
| 295 | crumblingRenderType, poseStack.last().copy(), model, state, lightCoords, overlayCoords, tintedColor, null, crumblingOverlay.cameraPose()
|
| 296 | )
|
| 297 | );
|
| 298 | }
|
| 299 | }
|
| 300 |
|
| 301 | @Override
|
| 302 | public void submitMovingBlock(final PoseStack poseStack, final MovingBlockRenderState movingBlockRenderState, final int outlineColor) {
|
| 303 | BlockStateModel model = Minecraft.getInstance().getModelManager().getBlockStateModelSet().get(movingBlockRenderState.blockState);
|
| 304 | boolean isTranslucent = model.hasMaterialFlag(1);
|
| 305 | MovingBlockFeatureRenderer.Submit submit = new MovingBlockFeatureRenderer.Submit(
|
| 306 | new Matrix4f(poseStack.last().pose()), movingBlockRenderState, 0, isTranslucent
|
| 307 | );
|
| 308 | if (isTranslucent) {
|
| 309 | this.translucentBlocksAndItems.submit(submit);
|
| 310 | } else {
|
| 311 | this.solid.submit(submit);
|
| 312 | }
|
| 313 |
|
| 314 | if (outlineColor != 0) {
|
| 315 | this.outline.submit(new MovingBlockFeatureRenderer.Submit(new Matrix4f(poseStack.last().pose()), movingBlockRenderState, outlineColor, false));
|
| 316 | }
|
| 317 | }
|
| 318 |
|
| 319 | @Override
|
| 320 | public void submitBlockModel(
|
| 321 | final PoseStack poseStack,
|
| 322 | final RenderType renderType,
|
| 323 | final List<BlockStateModelPart> modelParts,
|
| 324 | final int[] tintLayers,
|
| 325 | final int lightCoords,
|
| 326 | final int overlayCoords,
|
| 327 | final int outlineColor
|
| 328 | ) {
|
| 329 | PoseStack.Pose pose = poseStack.last().copy();
|
| 330 | if (!renderType.isOutline()) {
|
| 331 | BlockModelFeatureRenderer.Submit submit = new BlockModelFeatureRenderer.Submit(
|
| 332 | pose, renderType, modelParts, tintLayers, lightCoords, overlayCoords, -1, null
|
| 333 | );
|
| 334 | if (renderType.hasBlending()) {
|
| 335 | this.translucentBlocksAndItems.submit(submit);
|
| 336 | } else {
|
| 337 | this.solid.submit(submit);
|
| 338 | }
|
| 339 | }
|
| 340 |
|
| 341 | if (outlineColor != 0) {
|
| 342 | RenderType outlineRenderType = getOutlineRenderType(renderType);
|
| 343 | if (outlineRenderType != null) {
|
| 344 | this.outline
|
| 345 | .submit(
|
| 346 | new BlockModelFeatureRenderer.Submit(
|
| 347 | pose, outlineRenderType, modelParts, BlockModelRenderState.EMPTY_TINTS, 15728880, OverlayTexture.NO_OVERLAY, outlineColor, null
|
| 348 | )
|
| 349 | );
|
| 350 | }
|
| 351 | }
|
| 352 | }
|
| 353 |
|
| 354 | private static @Nullable RenderType getOutlineRenderType(final RenderType renderType) {
|
| 355 | if (renderType.isOutline()) {
|
| 356 | return renderType;
|
| 357 | } else {
|
| 358 | return renderType.outline().isPresent() ? renderType.outline().get() : null;
|
| 359 | }
|
| 360 | }
|
| 361 |
|
| 362 | @Override
|
| 363 | public void submitBreakingBlockModel(final PoseStack poseStack, final List<BlockStateModelPart> parts, final int progress, final boolean isBlockTranslucent) {
|
| 364 | PoseStack.Pose pose = poseStack.last().copy();
|
| 365 | List<RenderType> destroyTypes = Minecraft.getInstance().gameRenderer.useImprovedTransparency() && isBlockTranslucent
|
| 366 | ? ModelBakery.DESTROY_TYPES_OIT
|
| 367 | : ModelBakery.DESTROY_TYPES;
|
| 368 | SimpleFeatureRenderPhase targetPhase = isBlockTranslucent ? this.breakingOverlay : this.solid;
|
| 369 | targetPhase.submit(
|
| 370 | new BlockModelFeatureRenderer.Submit(
|
| 371 | pose, destroyTypes.get(progress), List.copyOf(parts), BlockModelRenderState.EMPTY_TINTS, 15728880, OverlayTexture.NO_OVERLAY, 0, pose
|
| 372 | )
|
| 373 | );
|
| 374 | }
|
| 375 |
|
| 376 | @Override
|
| 377 | public void submitShapeOutline(
|
| 378 | final PoseStack poseStack, final VoxelShape shape, final RenderType renderType, final int color, final float width, final boolean afterTerrain
|
| 379 | ) {
|
| 380 | ShapeOutlineFeatureRenderer.Submit submit = new ShapeOutlineFeatureRenderer.Submit(poseStack.last().copy(), shape, renderType, color, width);
|
| 381 | if (ARGB.alpha(color) == 255) {
|
| 382 | this.solid.submit(submit);
|
| 383 | } else if (afterTerrain) {
|
| 384 | this.afterTerrain.submit(submit);
|
| 385 | } else {
|
| 386 | this.shapeOutlines.submit(submit);
|
| 387 | }
|
| 388 | }
|
| 389 |
|
| 390 | @Override
|
| 391 | public void submitItem(
|
| 392 | final PoseStack poseStack,
|
| 393 | final ItemDisplayContext displayContext,
|
| 394 | final int lightCoords,
|
| 395 | final int overlayCoords,
|
| 396 | final int outlineColor,
|
| 397 | final int[] tintLayers,
|
| 398 | final ItemQuads quads,
|
| 399 | final ItemStackRenderState.FoilType foilType
|
| 400 | ) {
|
| 401 | PoseStack.Pose pose = poseStack.last().copy();
|
| 402 | if (!quads.translucent().isEmpty()) {
|
| 403 | this.translucentBlocksAndItems
|
| 404 | .submit(new ItemFeatureRenderer.Submit(pose, displayContext, lightCoords, overlayCoords, 0, tintLayers, quads.translucent(), foilType));
|
| 405 | }
|
| 406 |
|
| 407 | if (!quads.solid().isEmpty()) {
|
| 408 | this.solid.submit(new ItemFeatureRenderer.Submit(pose, displayContext, lightCoords, overlayCoords, 0, tintLayers, quads.solid(), foilType));
|
| 409 | }
|
| 410 |
|
| 411 | if (outlineColor != 0) {
|
| 412 | this.outline
|
| 413 | .submit(
|
| 414 | new ItemFeatureRenderer.Submit(
|
| 415 | pose,
|
| 416 | displayContext,
|
| 417 | 15728880,
|
| 418 | OverlayTexture.NO_OVERLAY,
|
| 419 | outlineColor,
|
| 420 | ItemStackRenderState.LayerRenderState.EMPTY_TINTS,
|
| 421 | quads.all(),
|
| 422 | ItemStackRenderState.FoilType.NONE
|
| 423 | )
|
| 424 | );
|
| 425 | }
|
| 426 | }
|
| 427 |
|
| 428 | @Override
|
| 429 | public void submitCustomGeometry(
|
| 430 | final PoseStack poseStack, final RenderType renderType, final SubmitNodeCollector.CustomGeometryRenderer customGeometryRenderer
|
| 431 | ) {
|
| 432 | CustomFeatureRenderer.Submit submit = new CustomFeatureRenderer.Submit(poseStack.last().copy(), renderType, customGeometryRenderer);
|
| 433 | if (renderType.isOutline()) {
|
| 434 | this.outline.submit(submit);
|
| 435 | } else if (renderType.hasBlending()) {
|
| 436 | this.translucentCustomGeometry.submit(submit);
|
| 437 | } else {
|
| 438 | this.solid.submit(submit);
|
| 439 | }
|
| 440 | }
|
| 441 |
|
| 442 | @Override
|
| 443 | public void submitQuadParticleGroup(final QuadParticleRenderState particles) {
|
| 444 | this.solid.submit(new QuadParticleFeatureRenderer.Submit(particles, false));
|
| 445 | this.afterTerrain.submit(new QuadParticleFeatureRenderer.Submit(particles, true));
|
| 446 | }
|
| 447 |
|
| 448 | @Override
|
| 449 | public void submitGizmoPrimitives(final DrawableGizmoPrimitives.Group group, final CameraRenderState camera, final boolean onTop) {
|
| 450 | GizmoFeatureRenderer.Submit submit = new GizmoFeatureRenderer.Submit(group, camera);
|
| 451 | if (onTop) {
|
| 452 | this.alwaysOnTopGizmos.submit(submit);
|
| 453 | } else if (group.opaque()) {
|
| 454 | this.solid.submit(submit);
|
| 455 | } else {
|
| 456 | this.translucentGizmos.submit(submit);
|
| 457 | }
|
| 458 | }
|
| 459 |
|
| 460 | public List<FeatureRenderPhase<?>> allPhases() {
|
| 461 | return this.allPhases;
|
| 462 | }
|
| 463 | }
|
| 464 |
|