51 lines
2.0 KiB
Java
51 lines
2.0 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* com.google.common.base.Suppliers
|
|
* org.joml.Vector3f
|
|
* org.jspecify.annotations.Nullable
|
|
*/
|
|
package net.minecraft.client.renderer.item;
|
|
|
|
import com.google.common.base.Suppliers;
|
|
import java.util.List;
|
|
import java.util.function.Supplier;
|
|
import net.minecraft.client.multiplayer.ClientLevel;
|
|
import net.minecraft.client.renderer.Sheets;
|
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
|
import net.minecraft.client.renderer.item.BlockModelWrapper;
|
|
import net.minecraft.client.renderer.item.ItemModel;
|
|
import net.minecraft.client.renderer.item.ItemModelResolver;
|
|
import net.minecraft.client.renderer.item.ItemStackRenderState;
|
|
import net.minecraft.client.renderer.item.ModelRenderProperties;
|
|
import net.minecraft.world.entity.ItemOwner;
|
|
import net.minecraft.world.item.ItemDisplayContext;
|
|
import net.minecraft.world.item.ItemStack;
|
|
import org.joml.Vector3f;
|
|
import org.jspecify.annotations.Nullable;
|
|
|
|
public class MissingItemModel
|
|
implements ItemModel {
|
|
private final List<BakedQuad> quads;
|
|
private final Supplier<Vector3f[]> extents;
|
|
private final ModelRenderProperties properties;
|
|
|
|
public MissingItemModel(List<BakedQuad> quads, ModelRenderProperties properties) {
|
|
this.quads = quads;
|
|
this.properties = properties;
|
|
this.extents = Suppliers.memoize(() -> BlockModelWrapper.computeExtents(this.quads));
|
|
}
|
|
|
|
@Override
|
|
public void update(ItemStackRenderState output, ItemStack item, ItemModelResolver resolver, ItemDisplayContext displayContext, @Nullable ClientLevel level, @Nullable ItemOwner owner, int seed) {
|
|
output.appendModelIdentityElement(this);
|
|
ItemStackRenderState.LayerRenderState layer = output.newLayer();
|
|
layer.setRenderType(Sheets.cutoutBlockSheet());
|
|
this.properties.applyToLayer(layer, displayContext);
|
|
layer.setExtents(this.extents);
|
|
layer.prepareQuadList().addAll(this.quads);
|
|
}
|
|
}
|
|
|