49 lines
1.8 KiB
Java
49 lines
1.8 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package net.minecraft.client.gui.render.pip;
|
|
|
|
import com.mojang.blaze3d.platform.Lighting;
|
|
import com.mojang.blaze3d.vertex.PoseStack;
|
|
import com.mojang.blaze3d.vertex.VertexConsumer;
|
|
import net.minecraft.client.Minecraft;
|
|
import net.minecraft.client.gui.render.pip.PictureInPictureRenderer;
|
|
import net.minecraft.client.gui.render.state.pip.GuiSignRenderState;
|
|
import net.minecraft.client.model.Model;
|
|
import net.minecraft.client.renderer.MultiBufferSource;
|
|
import net.minecraft.client.renderer.Sheets;
|
|
import net.minecraft.client.renderer.texture.OverlayTexture;
|
|
import net.minecraft.client.resources.model.Material;
|
|
import net.minecraft.client.resources.model.MaterialSet;
|
|
|
|
public class GuiSignRenderer
|
|
extends PictureInPictureRenderer<GuiSignRenderState> {
|
|
private final MaterialSet materials;
|
|
|
|
public GuiSignRenderer(MultiBufferSource.BufferSource bufferSource, MaterialSet materials) {
|
|
super(bufferSource);
|
|
this.materials = materials;
|
|
}
|
|
|
|
@Override
|
|
public Class<GuiSignRenderState> getRenderStateClass() {
|
|
return GuiSignRenderState.class;
|
|
}
|
|
|
|
@Override
|
|
protected void renderToTexture(GuiSignRenderState renderState, PoseStack poseStack) {
|
|
Minecraft.getInstance().gameRenderer.getLighting().setupFor(Lighting.Entry.ITEMS_FLAT);
|
|
poseStack.translate(0.0f, -0.75f, 0.0f);
|
|
Material material = Sheets.getSignMaterial(renderState.woodType());
|
|
Model.Simple model = renderState.signModel();
|
|
VertexConsumer buffer = material.buffer(this.materials, this.bufferSource, model::renderType);
|
|
model.renderToBuffer(poseStack, buffer, 0xF000F0, OverlayTexture.NO_OVERLAY);
|
|
}
|
|
|
|
@Override
|
|
protected String getTextureLabel() {
|
|
return "sign";
|
|
}
|
|
}
|
|
|