/* * Decompiled with CFR 0.152. * * Could not load the following classes: * com.mojang.datafixers.kinds.App * com.mojang.datafixers.kinds.Applicative * com.mojang.serialization.Codec * 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.Codec; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Set; import net.minecraft.client.model.ChestModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.Sheets; import net.minecraft.client.renderer.SubmitNodeCollector; import net.minecraft.client.renderer.rendertype.RenderTypes; 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 org.joml.Vector3f; public class ChestSpecialRenderer implements NoDataSpecialModelRenderer { public static final Identifier GIFT_CHEST_TEXTURE = Identifier.withDefaultNamespace("christmas"); public static final Identifier NORMAL_CHEST_TEXTURE = Identifier.withDefaultNamespace("normal"); public static final Identifier TRAPPED_CHEST_TEXTURE = Identifier.withDefaultNamespace("trapped"); public static final Identifier ENDER_CHEST_TEXTURE = Identifier.withDefaultNamespace("ender"); public static final Identifier COPPER_CHEST_TEXTURE = Identifier.withDefaultNamespace("copper"); public static final Identifier EXPOSED_COPPER_CHEST_TEXTURE = Identifier.withDefaultNamespace("copper_exposed"); public static final Identifier WEATHERED_COPPER_CHEST_TEXTURE = Identifier.withDefaultNamespace("copper_weathered"); public static final Identifier OXIDIZED_COPPER_CHEST_TEXTURE = Identifier.withDefaultNamespace("copper_oxidized"); private final MaterialSet materials; private final ChestModel model; private final Material material; private final float openness; public ChestSpecialRenderer(MaterialSet materials, ChestModel model, Material material, float openness) { this.materials = materials; this.model = model; this.material = material; this.openness = openness; } @Override public void submit(ItemDisplayContext type, PoseStack poseStack, SubmitNodeCollector submitNodeCollector, int lightCoords, int overlayCoords, boolean hasFoil, int outlineColor) { submitNodeCollector.submitModel(this.model, Float.valueOf(this.openness), poseStack, this.material.renderType(RenderTypes::entitySolid), lightCoords, overlayCoords, -1, this.materials.get(this.material), outlineColor, null); } @Override public void getExtents(Set result) { PoseStack poseStack = new PoseStack(); this.model.setupAnim(Float.valueOf(this.openness)); this.model.root().getExtentsForGui(poseStack, result); } public record Unbaked(Identifier texture, float openness) implements SpecialModelRenderer.Unbaked { public static final MapCodec MAP_CODEC = RecordCodecBuilder.mapCodec(i -> i.group((App)Identifier.CODEC.fieldOf("texture").forGetter(Unbaked::texture), (App)Codec.FLOAT.optionalFieldOf("openness", (Object)Float.valueOf(0.0f)).forGetter(Unbaked::openness)).apply((Applicative)i, Unbaked::new)); public Unbaked(Identifier texture) { this(texture, 0.0f); } public MapCodec type() { return MAP_CODEC; } @Override public SpecialModelRenderer bake(SpecialModelRenderer.BakingContext context) { ChestModel model = new ChestModel(context.entityModelSet().bakeLayer(ModelLayers.CHEST)); Material fullTexture = Sheets.CHEST_MAPPER.apply(this.texture); return new ChestSpecialRenderer(context.materials(), model, fullTexture, this.openness); } } }