SulfurCubeInnerLayer .java

net.minecraft.client.renderer.entity.layers.SulfurCubeInnerLayer (class): members: SULFUR_CUBE_SMALL_INNER_LOCATION, SULFUR_CUBE_INNER_LOCATION, yRot.

net.minecraft.client.renderer.entity.layersclass64 linesclientextends RenderLayer<SulfurCubeRenderState3.0 KB

API Surface (1)

void submit(final PoseStack poseStack, final SubmitNodeCollector submitNodeCollector, final int lightCoords, final SulfurCubeRenderState state, final float yRot, final float xRot)

Fields & Constants (9)

SULFUR_CUBE_INNER_LOCATION
SULFUR_CUBE_SMALL_INNER_LOCATION
normalModel
smallModel
poseStack
submitNodeCollector
lightCoords
state
yRot

Full Source

SulfurCubeInnerLayer.java64 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.renderer.entity.layers;
2
3
import com.mojang.blaze3d.vertex.PoseStack;
4
import com.mojang.math.Axis;
5
import net.fabricmc.api.EnvType;
6
import net.fabricmc.api.Environment;
7
import net.minecraft.client.model.geom.EntityModelSet;
8
import net.minecraft.client.model.geom.ModelLayers;
9
import net.minecraft.client.model.monster.slime.SulfurCubeModel;
10
import net.minecraft.client.renderer.SubmitNodeCollector;
11
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
12
import net.minecraft.client.renderer.entity.RenderLayerParent;
13
import net.minecraft.client.renderer.entity.TntRenderer;
14
import net.minecraft.client.renderer.entity.state.SulfurCubeRenderState;
15
import net.minecraft.client.renderer.rendertype.RenderType;
16
import net.minecraft.client.renderer.rendertype.RenderTypes;
17
import net.minecraft.client.renderer.texture.OverlayTexture;
18
import net.minecraft.resources.Identifier;
19
20
@Environment(EnvType.CLIENT)
21
public class SulfurCubeInnerLayer extends RenderLayer<SulfurCubeRenderState, SulfurCubeModel> {
22
	private static final Identifier SULFUR_CUBE_INNER_LOCATION = Identifier.withDefaultNamespace("textures/entity/sulfur_cube/sulfur_cube_inner.png");
23
	private static final Identifier SULFUR_CUBE_SMALL_INNER_LOCATION = Identifier.withDefaultNamespace("textures/entity/sulfur_cube/sulfur_cube_inner_small.png");
24
	private final SulfurCubeModel normalModel;
25
	private final SulfurCubeModel smallModel;
26
27
	public SulfurCubeInnerLayer(final RenderLayerParent<SulfurCubeRenderState, SulfurCubeModel> renderer, final EntityModelSet modelSet) {
28
		super(renderer);
29
		this.normalModel = new SulfurCubeModel(modelSet.bakeLayer(ModelLayers.SULFUR_CUBE_INNER));
30
		this.smallModel = new SulfurCubeModel(modelSet.bakeLayer(ModelLayers.SULFUR_CUBE_SMALL_INNER));
31
	}
32
33
	public void submit(
34
		final PoseStack poseStack,
35
		final SubmitNodeCollector submitNodeCollector,
36
		final int lightCoords,
37
		final SulfurCubeRenderState state,
38
		final float yRot,
39
		final float xRot
40
	) {
41
		if (state.wornHeadType == null) {
42
			int overlayCoords = state.fuseRemainingTicks > 0.0F && TntRenderer.isLit(state.fuseRemainingTicks)
43
				? OverlayTexture.pack(OverlayTexture.u(1.0F), 10)
44
				: LivingEntityRenderer.getOverlayCoords(state, 0.0F);
45
			if (!state.containedBlock.isEmpty()) {
46
				poseStack.pushPose();
47
				poseStack.rotateDegrees(Axis.XP, 180.0F);
48
				if (state.isBaby) {
49
					poseStack.scale(0.5F, 0.5F, 0.5F);
50
				}
51
52
				poseStack.translate(-0.5F, -0.518F, -0.5F);
53
				state.containedBlock.submit(poseStack, submitNodeCollector, state.lightCoords, overlayCoords, state.outlineColor);
54
				poseStack.popPose();
55
			} else if (!state.isInvisible) {
56
				Identifier location = state.isBaby ? SULFUR_CUBE_SMALL_INNER_LOCATION : SULFUR_CUBE_INNER_LOCATION;
57
				SulfurCubeModel model = state.isBaby ? this.smallModel : this.normalModel;
58
				RenderType renderType = RenderTypes.entityTranslucent(location);
59
				submitNodeCollector.order(-1).submitModel(model, state, poseStack, renderType, lightCoords, overlayCoords, -1, null, state.outlineColor);
60
			}
61
		}
62
	}
63
}
64

Decompiled Minecraft 26.3 source of SulfurCubeInnerLayer (net/minecraft/client/renderer/entity/layers/SulfurCubeInnerLayer.java) with Mojang official mappings, stored verbatim on the site.