We don't need this to be a model, just use the part

This commit is contained in:
Sollace 2023-12-05 23:06:52 +00:00
parent a7ff78e141
commit f8fc9467be
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB

View file

@ -7,8 +7,8 @@ import net.minecraft.client.MinecraftClient;
import net.minecraft.client.item.ClampedModelPredicateProvider; import net.minecraft.client.item.ClampedModelPredicateProvider;
import net.minecraft.client.item.ModelPredicateProviderRegistry; import net.minecraft.client.item.ModelPredicateProviderRegistry;
import net.minecraft.client.model.*; import net.minecraft.client.model.*;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.entity.model.TridentEntityModel;
import net.minecraft.client.render.item.ItemRenderer; import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.render.model.json.ModelTransformationMode; import net.minecraft.client.render.model.json.ModelTransformationMode;
@ -26,7 +26,7 @@ public class PolearmRenderer implements DynamicItemRenderer, ClampedModelPredica
private static final PolearmRenderer INSTANCE = new PolearmRenderer(); private static final PolearmRenderer INSTANCE = new PolearmRenderer();
private static final Identifier THROWING = new Identifier("throwing"); private static final Identifier THROWING = new Identifier("throwing");
private final TridentEntityModel model = new TridentEntityModel(getTexturedModelData().createModel()); private final ModelPart model = getTexturedModelData().createModel();
public static void register(Item...items) { public static void register(Item...items) {
for (Item item : items) { for (Item item : items) {
@ -89,7 +89,7 @@ public class PolearmRenderer implements DynamicItemRenderer, ClampedModelPredica
} }
Identifier id = Registries.ITEM.getId(stack.getItem()); Identifier id = Registries.ITEM.getId(stack.getItem());
Identifier texture = new Identifier(id.getNamespace(), "textures/entity/polearm/" + id.getPath() + ".png"); Identifier texture = new Identifier(id.getNamespace(), "textures/entity/polearm/" + id.getPath() + ".png");
model.render(matrices, ItemRenderer.getDirectItemGlintConsumer(vertexConsumers, model.getLayer(texture), false, stack.hasGlint()), light, overlay, 1, 1, 1, 1); model.render(matrices, ItemRenderer.getDirectItemGlintConsumer(vertexConsumers, RenderLayer.getEntitySolid(texture), false, stack.hasGlint()), light, overlay, 1, 1, 1, 1);
matrices.pop(); matrices.pop();
} }
} }