/* * 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.renderer.Sheets; import net.minecraft.client.renderer.SubmitNodeCollector; import net.minecraft.client.renderer.blockentity.ShulkerBoxRenderer; import net.minecraft.client.renderer.special.NoDataSpecialModelRenderer; import net.minecraft.client.renderer.special.SpecialModelRenderer; import net.minecraft.client.resources.model.Material; import net.minecraft.core.Direction; import net.minecraft.resources.Identifier; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.ItemDisplayContext; import org.joml.Vector3f; public class ShulkerBoxSpecialRenderer implements NoDataSpecialModelRenderer { private final ShulkerBoxRenderer shulkerBoxRenderer; private final float openness; private final Direction orientation; private final Material material; public ShulkerBoxSpecialRenderer(ShulkerBoxRenderer shulkerBoxRenderer, float openness, Direction orientation, Material material) { this.shulkerBoxRenderer = shulkerBoxRenderer; this.openness = openness; this.orientation = orientation; this.material = material; } @Override public void submit(ItemDisplayContext type, PoseStack poseStack, SubmitNodeCollector submitNodeCollector, int lightCoords, int overlayCoords, boolean hasFoil, int outlineColor) { this.shulkerBoxRenderer.submit(poseStack, submitNodeCollector, lightCoords, overlayCoords, this.orientation, this.openness, null, this.material, outlineColor); } @Override public void getExtents(Set result) { this.shulkerBoxRenderer.getExtents(this.orientation, this.openness, result); } public record Unbaked(Identifier texture, float openness, Direction orientation) 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), (App)Direction.CODEC.optionalFieldOf("orientation", Direction.UP).forGetter(Unbaked::orientation)).apply((Applicative)i, Unbaked::new)); public Unbaked() { this(Identifier.withDefaultNamespace("shulker"), 0.0f, Direction.UP); } public Unbaked(DyeColor color) { this(Sheets.colorToShulkerMaterial(color), 0.0f, Direction.UP); } public MapCodec type() { return MAP_CODEC; } @Override public SpecialModelRenderer bake(SpecialModelRenderer.BakingContext context) { return new ShulkerBoxSpecialRenderer(new ShulkerBoxRenderer(context), this.openness, this.orientation, Sheets.SHULKER_MAPPER.apply(this.texture)); } } }