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

69 lines
2.5 KiB
Java

/*
* 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.Set;
import net.minecraft.client.renderer.Sheets;
import net.minecraft.client.renderer.SubmitNodeCollector;
import net.minecraft.client.renderer.blockentity.BedRenderer;
import net.minecraft.client.renderer.special.NoDataSpecialModelRenderer;
import net.minecraft.client.renderer.special.SpecialModelRenderer;
import net.minecraft.client.resources.model.Material;
import net.minecraft.resources.Identifier;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.ItemDisplayContext;
import org.joml.Vector3f;
public class BedSpecialRenderer
implements NoDataSpecialModelRenderer {
private final BedRenderer bedRenderer;
private final Material material;
public BedSpecialRenderer(BedRenderer bedRenderer, Material material) {
this.bedRenderer = bedRenderer;
this.material = material;
}
@Override
public void submit(ItemDisplayContext type, PoseStack poseStack, SubmitNodeCollector submitNodeCollector, int lightCoords, int overlayCoords, boolean hasFoil, int outlineColor) {
this.bedRenderer.submitSpecial(poseStack, submitNodeCollector, lightCoords, overlayCoords, this.material, outlineColor);
}
@Override
public void getExtents(Set<Vector3f> result) {
this.bedRenderer.getExtents(result);
}
public record Unbaked(Identifier texture) implements SpecialModelRenderer.Unbaked
{
public static final MapCodec<Unbaked> MAP_CODEC = RecordCodecBuilder.mapCodec(i -> i.group((App)Identifier.CODEC.fieldOf("texture").forGetter(Unbaked::texture)).apply((Applicative)i, Unbaked::new));
public Unbaked(DyeColor dyeColor) {
this(Sheets.colorToResourceMaterial(dyeColor));
}
public MapCodec<Unbaked> type() {
return MAP_CODEC;
}
@Override
public SpecialModelRenderer<?> bake(SpecialModelRenderer.BakingContext context) {
return new BedSpecialRenderer(new BedRenderer(context), Sheets.BED_MAPPER.apply(this.texture));
}
}
}