minecraft-src/net/minecraft/client/renderer/item/ItemModel.java
2025-07-04 03:15:13 +03:00

43 lines
1.5 KiB
Java

package net.minecraft.client.renderer.item;
import com.mojang.serialization.MapCodec;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.model.geom.EntityModelSet;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.client.resources.model.BlockModelRotation;
import net.minecraft.client.resources.model.ModelBaker;
import net.minecraft.client.resources.model.ResolvableModel;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import org.jetbrains.annotations.Nullable;
@Environment(EnvType.CLIENT)
public interface ItemModel {
void update(
ItemStackRenderState renderState,
ItemStack stack,
ItemModelResolver itemModelResolver,
ItemDisplayContext displayContext,
@Nullable ClientLevel level,
@Nullable LivingEntity entity,
int seed
);
@Environment(EnvType.CLIENT)
public record BakingContext(ModelBaker blockModelBaker, EntityModelSet entityModelSet, ItemModel missingItemModel) {
public BakedModel bake(ResourceLocation location) {
return this.blockModelBaker().bake(location, BlockModelRotation.X0_Y0);
}
}
@Environment(EnvType.CLIENT)
public interface Unbaked extends ResolvableModel {
MapCodec<? extends ItemModel.Unbaked> type();
ItemModel bake(ItemModel.BakingContext context);
}
}