/* * Decompiled with CFR 0.152. * * Could not load the following classes: * com.mojang.datafixers.kinds.App * com.mojang.datafixers.kinds.Applicative * com.mojang.serialization.MapCodec * com.mojang.serialization.codecs.RecordCodecBuilder * org.joml.Vector3f */ package net.minecraft.client.renderer.special; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.datafixers.kinds.App; import com.mojang.datafixers.kinds.Applicative; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Optional; import java.util.Set; import net.minecraft.client.model.Model; import net.minecraft.client.renderer.Sheets; import net.minecraft.client.renderer.SubmitNodeCollector; import net.minecraft.client.renderer.blockentity.HangingSignRenderer; import net.minecraft.client.renderer.special.NoDataSpecialModelRenderer; import net.minecraft.client.renderer.special.SpecialModelRenderer; import net.minecraft.client.resources.model.Material; import net.minecraft.client.resources.model.MaterialSet; import net.minecraft.resources.Identifier; import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.level.block.state.properties.WoodType; import org.joml.Vector3f; public class HangingSignSpecialRenderer implements NoDataSpecialModelRenderer { private final MaterialSet materials; private final Model.Simple model; private final Material material; public HangingSignSpecialRenderer(MaterialSet materials, Model.Simple model, Material material) { this.materials = materials; this.model = model; this.material = material; } @Override public void submit(ItemDisplayContext type, PoseStack poseStack, SubmitNodeCollector submitNodeCollector, int lightCoords, int overlayCoords, boolean hasFoil, int outlineColor) { HangingSignRenderer.submitSpecial(this.materials, poseStack, submitNodeCollector, lightCoords, overlayCoords, this.model, this.material); } @Override public void getExtents(Set result) { PoseStack poseStack = new PoseStack(); HangingSignRenderer.translateBase(poseStack, 0.0f); poseStack.scale(1.0f, -1.0f, -1.0f); this.model.root().getExtentsForGui(poseStack, result); } public record Unbaked(WoodType woodType, Optional texture) implements SpecialModelRenderer.Unbaked { public static final MapCodec MAP_CODEC = RecordCodecBuilder.mapCodec(i -> i.group((App)WoodType.CODEC.fieldOf("wood_type").forGetter(Unbaked::woodType), (App)Identifier.CODEC.optionalFieldOf("texture").forGetter(Unbaked::texture)).apply((Applicative)i, Unbaked::new)); public Unbaked(WoodType woodType) { this(woodType, Optional.empty()); } public MapCodec type() { return MAP_CODEC; } @Override public SpecialModelRenderer bake(SpecialModelRenderer.BakingContext context) { Model.Simple model = HangingSignRenderer.createSignModel(context.entityModelSet(), this.woodType, HangingSignRenderer.AttachmentType.CEILING_MIDDLE); Material material = this.texture.map(Sheets.HANGING_SIGN_MAPPER::apply).orElseGet(() -> Sheets.getHangingSignMaterial(this.woodType)); return new HangingSignSpecialRenderer(context.materials(), model, material); } } }