27 lines
1.3 KiB
Java
27 lines
1.3 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package net.minecraft.client.renderer.item;
|
|
|
|
import net.minecraft.client.renderer.block.model.ItemTransforms;
|
|
import net.minecraft.client.renderer.block.model.TextureSlots;
|
|
import net.minecraft.client.renderer.item.ItemStackRenderState;
|
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
|
import net.minecraft.client.resources.model.ModelBaker;
|
|
import net.minecraft.client.resources.model.ResolvedModel;
|
|
import net.minecraft.world.item.ItemDisplayContext;
|
|
|
|
public record ModelRenderProperties(boolean usesBlockLight, TextureAtlasSprite particleIcon, ItemTransforms transforms) {
|
|
public static ModelRenderProperties fromResolvedModel(ModelBaker baker, ResolvedModel resolvedModel, TextureSlots textureSlots) {
|
|
TextureAtlasSprite particleSprite = resolvedModel.resolveParticleSprite(textureSlots, baker);
|
|
return new ModelRenderProperties(resolvedModel.getTopGuiLight().lightLikeBlock(), particleSprite, resolvedModel.getTopTransforms());
|
|
}
|
|
|
|
public void applyToLayer(ItemStackRenderState.LayerRenderState layer, ItemDisplayContext displayContext) {
|
|
layer.setUsesBlockLight(this.usesBlockLight);
|
|
layer.setParticleIcon(this.particleIcon);
|
|
layer.setTransform(this.transforms.getTransform(displayContext));
|
|
}
|
|
}
|
|
|