Whenever I summon my entity it's crash game and show me
Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.client.model.geom.ModelPart.render(com.mojang.blaze3d.vertex.PoseStack, com.mojang.blaze3d.vertex.VertexConsumer, int, int, float, float, float, float)" because "this.Ciastko" is null
but when I delete Ciastko.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); in
package dev.kemfo.Ciastkoludek.client.models;// Made with Blockbench 4.6.5
// Exported for Minecraft version 1.17 or later with Mojang mappings
// Paste this class into your mod and generate all required imports
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import dev.kemfo.Ciastkoludek.ciastkoludek;
import dev.kemfo.Ciastkoludek.entities.ciastek;
import net.minecraft.client.model.EntityModel;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*;
import net.minecraft.resources.ResourceLocation;
import org.jetbrains.annotations.NotNull;
public class CiastekModel extends EntityModel<ciastek> {
// This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor
public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(ciastkoludek.MODID, "ciastek"), "main");
private ModelPart Ciastko;
public CiastekModel(ModelPart root, float v) {
this.Ciastko = root.getChild("Ciastko");
}
public CiastekModel(ModelPart root, ModelPart ciastko) {
Ciastko = ciastko;
}
public CiastekModel(ModelPart bakedLayer) {
}
public static LayerDefinition createBodyLayer() {
var mesh = new MeshDefinition();
PartDefinition parts = mesh.getRoot();
PartDefinition Ciastko = parts.addOrReplaceChild("Ciastko", CubeListBuilder.create().texOffs(0, 0).addBox(-3.0F, -11.0F, -2.0F, 6.0F, 8.0F, 3.0F, new CubeDeformation(0.0F))
.texOffs(0, 17).addBox(-4.0F, -10.0F, -2.0F, 1.0F, 6.0F, 3.0F, new CubeDeformation(0.0F))
.texOffs(18, 0).addBox(-5.0F, -9.0F, -2.0F, 1.0F, 4.0F, 3.0F, new CubeDeformation(0.0F))
.texOffs(15, 8).addBox(3.0F, -10.0F, -2.0F, 1.0F, 6.0F, 3.0F, new CubeDeformation(0.0F))
.texOffs(16, 17).addBox(4.0F, -9.0F, -2.0F, 1.0F, 4.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F));
Ciastko.addOrReplaceChild("Nogi", CubeListBuilder.create().texOffs(0, 11).addBox(1.0F, -3.0F, -1.0F, 1.0F, 2.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(7, 11).addBox(-2.0F, -3.0F, -1.0F, 1.0F, 2.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 0.0F));
Ciastko.addOrReplaceChild("Rece", CubeListBuilder.create().texOffs(0, 11).addBox(5.0F, -7.0F, -5.0F, 1.0F, 1.0F, 5.0F, new CubeDeformation(0.0F))
.texOffs(7, 12).addBox(-6.0F, -7.0F, -5.0F, 1.0F, 1.0F, 5.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 0.0F));
Ciastko.addOrReplaceChild("Buty", CubeListBuilder.create().texOffs(15, 0).addBox(1.0F, -1.0F, -2.0F, 1.0F, 1.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(8, 18).addBox(-2.0F, -1.0F, -2.0F, 1.0F, 1.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 0.0F));
return LayerDefinition.create(mesh, 32, 32);
}
@Override
public void setupAnim(ciastek entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
}
@Override
public void renderToBuffer(@NotNull PoseStack poseStack, @NotNull VertexConsumer vertexConsumer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
Ciastko.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
}
}
it don't crush but there is no texture in my entity I need help