2025-11-24 22:52:51 +03:00

81 lines
4.1 KiB
Java

/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* org.joml.Quaternionfc
*/
package net.minecraft.client.renderer.entity.layers;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Axis;
import net.minecraft.client.model.CowModel;
import net.minecraft.client.renderer.SubmitNodeCollector;
import net.minecraft.client.renderer.block.BlockRenderDispatcher;
import net.minecraft.client.renderer.block.model.BlockStateModel;
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
import net.minecraft.client.renderer.entity.RenderLayerParent;
import net.minecraft.client.renderer.entity.layers.RenderLayer;
import net.minecraft.client.renderer.entity.state.MushroomCowRenderState;
import net.minecraft.client.renderer.rendertype.RenderTypes;
import net.minecraft.client.renderer.texture.TextureAtlas;
import net.minecraft.world.level.block.state.BlockState;
import org.joml.Quaternionfc;
public class MushroomCowMushroomLayer
extends RenderLayer<MushroomCowRenderState, CowModel> {
private final BlockRenderDispatcher blockRenderer;
public MushroomCowMushroomLayer(RenderLayerParent<MushroomCowRenderState, CowModel> renderer, BlockRenderDispatcher blockRenderer) {
super(renderer);
this.blockRenderer = blockRenderer;
}
@Override
public void submit(PoseStack poseStack, SubmitNodeCollector submitNodeCollector, int lightCoords, MushroomCowRenderState state, float yRot, float xRot) {
boolean appearsGlowingWithInvisibility;
if (state.isBaby) {
return;
}
boolean bl = appearsGlowingWithInvisibility = state.appearsGlowing() && state.isInvisible;
if (state.isInvisible && !appearsGlowingWithInvisibility) {
return;
}
BlockState mushroomBlockState = state.variant.getBlockState();
int overlayCoords = LivingEntityRenderer.getOverlayCoords(state, 0.0f);
BlockStateModel model = this.blockRenderer.getBlockModel(mushroomBlockState);
poseStack.pushPose();
poseStack.translate(0.2f, -0.35f, 0.5f);
poseStack.mulPose((Quaternionfc)Axis.YP.rotationDegrees(-48.0f));
poseStack.scale(-1.0f, -1.0f, 1.0f);
poseStack.translate(-0.5f, -0.5f, -0.5f);
this.submitMushroomBlock(poseStack, submitNodeCollector, lightCoords, appearsGlowingWithInvisibility, state.outlineColor, mushroomBlockState, overlayCoords, model);
poseStack.popPose();
poseStack.pushPose();
poseStack.translate(0.2f, -0.35f, 0.5f);
poseStack.mulPose((Quaternionfc)Axis.YP.rotationDegrees(42.0f));
poseStack.translate(0.1f, 0.0f, -0.6f);
poseStack.mulPose((Quaternionfc)Axis.YP.rotationDegrees(-48.0f));
poseStack.scale(-1.0f, -1.0f, 1.0f);
poseStack.translate(-0.5f, -0.5f, -0.5f);
this.submitMushroomBlock(poseStack, submitNodeCollector, lightCoords, appearsGlowingWithInvisibility, state.outlineColor, mushroomBlockState, overlayCoords, model);
poseStack.popPose();
poseStack.pushPose();
((CowModel)this.getParentModel()).getHead().translateAndRotate(poseStack);
poseStack.translate(0.0f, -0.7f, -0.2f);
poseStack.mulPose((Quaternionfc)Axis.YP.rotationDegrees(-78.0f));
poseStack.scale(-1.0f, -1.0f, 1.0f);
poseStack.translate(-0.5f, -0.5f, -0.5f);
this.submitMushroomBlock(poseStack, submitNodeCollector, lightCoords, appearsGlowingWithInvisibility, state.outlineColor, mushroomBlockState, overlayCoords, model);
poseStack.popPose();
}
private void submitMushroomBlock(PoseStack poseStack, SubmitNodeCollector submitNodeCollector, int lightCoords, boolean appearsGlowingWithInvisibility, int outlineColor, BlockState mushroomBlockState, int overlayCoords, BlockStateModel model) {
if (appearsGlowingWithInvisibility) {
submitNodeCollector.submitBlockModel(poseStack, RenderTypes.outline(TextureAtlas.LOCATION_BLOCKS), model, 0.0f, 0.0f, 0.0f, lightCoords, overlayCoords, outlineColor);
} else {
submitNodeCollector.submitBlock(poseStack, mushroomBlockState, lightCoords, overlayCoords, outlineColor);
}
}
}