Started by
Mariolover63
on
Topic category: Troubleshooting, bugs, and solutions
I was making a plush for my mod, BUT when I try to import the model for it, the error 'Your model name is invalid' shows up. The filename is plush.java by the way.
nvm the problem was the // thingies at the very top (no one should go through this frustration)
the name in the code is different from the filename
I tried the tutorial, I changed the version, I changed the name in the modeler but the problem continues
// Made with Blockbench 4.2.1
// Exported for Minecraft version 1.7 - 1.12
// Paste this class into your mod and generate all required imports
public class something_name extends ModelBase {
private final ModelRenderer head;
private final ModelRenderer leg;
private final ModelRenderer chest;
private final ModelRenderer bb_main;
private final ModelRenderer leftarm_r1;
private final ModelRenderer rightarm_r1;
public something_name() {
textureWidth = 16;
textureHeight = 16;
head = new ModelRenderer(this);
head.setRotationPoint(0.0F, 0.0F, 0.0F);
head.cubeList.add(new ModelBox(head, 0, 0, -3.0F, -12.0F, -3.0F, 5, 6, 5, 0.0F, false));
head.cubeList.add(new ModelBox(head, 32, 0, -3.0F, -8.0F, -4.0F, 7, 8, 7, 0.5F, false));
leg = new ModelRenderer(this);
leg.setRotationPoint(0.0F, 0.0F, 0.0F);
leg.cubeList.add(new ModelBox(leg, 16, 16, -3.0F, 7.0F, -3.0F, 5, 17, 5, 0.0F, false));
leg.cubeList.add(new ModelBox(leg, 16, 16, -2.0F, 2.0F, -2.0F, 3, 5, 3, 0.0F, false));
leg.cubeList.add(new ModelBox(leg, 16, 32, -4.0F, 0.0F, -2.0F, 8, 12, 4, 0.25F, false));
chest = new ModelRenderer(this);
chest.setRotationPoint(0.0F, 24.0F, 0.0F);
chest.cubeList.add(new ModelBox(chest, 0, 0, -6.0F, -27.0F, -3.0F, 11, 5, 5, 0.0F, false));
bb_main = new ModelRenderer(this);
bb_main.setRotationPoint(0.0F, 24.0F, 0.0F);
bb_main.cubeList.add(new ModelBox(bb_main, 0, 0, -2.0F, -30.0F, -2.0F, 3, 3, 3, 0.0F, false));
leftarm_r1 = new ModelRenderer(this);
leftarm_r1.setRotationPoint(0.0F, 0.0F, 0.0F);
bb_main.addChild(leftarm_r1);
setRotationAngle(leftarm_r1, 0.0F, 0.0F, -0.3491F);
leftarm_r1.cubeList.add(new ModelBox(leftarm_r1, 0, 0, 13.0F, -20.0F, -2.0F, 3, -4, 3, 0.0F, false));
rightarm_r1 = new ModelRenderer(this);
rightarm_r1.setRotationPoint(0.0F, 0.0F, 0.0F);
bb_main.addChild(rightarm_r1);
setRotationAngle(rightarm_r1, 0.0F, 0.0F, 0.2618F);
rightarm_r1.cubeList.add(new ModelBox(rightarm_r1, 0, 0, -15.0F, -17.0F, -2.0F, 3, -8, 3, 0.0F, false));
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
head.render(f5);
leg.render(f5);
chest.render(f5);
bb_main.render(f5);
}
public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
}
I'm making a car for my mod, BUT when I try to import the corresponding model I get the error "Your model name is invalid".
here is the java code:
// Made with Blockbench 4.9.4
// Exported for Minecraft version 1.17 or later with Mojang mappings
// Paste this class into your mod and generate all required imports
public class car<T extends Entity> extends EntityModel<T> {
// 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("modid", "car"), "main");
private final ModelPart bb_main;
public car(ModelPart root) {
this.bb_main = root.getChild("bb_main");
}
public static LayerDefinition createBodyLayer() {
MeshDefinition meshdefinition = new MeshDefinition();
PartDefinition partdefinition = meshdefinition.getRoot();
PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(0, 0).addBox(15.0F, -15.0F, -24.0F, 1.0F, 10.0F, 48.0F, new CubeDeformation(0.0F))
.texOffs(0, 0).addBox(-16.0F, -15.0F, -24.0F, 1.0F, 10.0F, 48.0F, new CubeDeformation(0.0F))
.texOffs(0, 60).addBox(-10.0F, -14.0F, -25.0F, 20.0F, 9.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(0, 123).addBox(-15.0F, -20.0F, -9.0F, 30.0F, 5.0F, 0.0F, new CubeDeformation(0.0F))
.texOffs(0, 0).addBox(-15.0F, -15.0F, -24.0F, 30.0F, 10.0F, 16.0F, new CubeDeformation(0.0F))
.texOffs(118, 123).addBox(-15.0F, -14.0F, -25.0F, 4.0F, 4.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(118, 123).addBox(11.0F, -14.0F, -25.0F, 4.0F, 4.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(0, 110).addBox(-15.0F, -9.0F, -25.0F, 4.0F, 2.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(0, 110).addBox(11.0F, -9.0F, -25.0F, 4.0F, 2.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(81, 62).addBox(12.0F, -14.0F, 24.0F, 3.0F, 5.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(81, 62).addBox(-15.0F, -14.0F, 24.0F, 3.0F, 5.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(0, 110).addBox(-15.0F, -8.0F, 24.0F, 3.0F, 2.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(0, 110).addBox(12.0F, -8.0F, 24.0F, 3.0F, 2.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(22, 61).addBox(-3.0F, -7.0F, 24.0F, 6.0F, 3.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(102, 52).addBox(-15.0F, -4.0F, -21.0F, 5.0F, 4.0F, 8.0F, new CubeDeformation(0.0F))
.texOffs(102, 52).addBox(-15.0F, -4.0F, 13.0F, 5.0F, 4.0F, 8.0F, new CubeDeformation(0.0F))
.texOffs(102, 52).addBox(10.0F, -4.0F, 13.0F, 5.0F, 4.0F, 8.0F, new CubeDeformation(0.0F))
.texOffs(102, 52).addBox(10.0F, -4.0F, -21.0F, 5.0F, 4.0F, 8.0F, new CubeDeformation(0.0F))
.texOffs(0, 0).addBox(16.0F, -11.0F, -23.0F, 1.0F, 7.0F, 12.0F, new CubeDeformation(0.0F))
.texOffs(0, 0).addBox(16.0F, -11.0F, 11.0F, 1.0F, 7.0F, 12.0F, new CubeDeformation(0.0F))
.texOffs(0, 0).addBox(-17.0F, -11.0F, 11.0F, 1.0F, 7.0F, 12.0F, new CubeDeformation(0.0F))
.texOffs(0, 0).addBox(-17.0F, -11.0F, -23.0F, 1.0F, 7.0F, 12.0F, new CubeDeformation(0.0F))
.texOffs(0, 60).addBox(-0.5F, -16.0F, -24.0F, 1.0F, 1.0F, 3.0F, new CubeDeformation(0.0F))
.texOffs(0, 0).addBox(-15.0F, -15.0F, 8.0F, 30.0F, 10.0F, 16.0F, new CubeDeformation(0.0F))
.texOffs(0, 73).addBox(-16.0F, -5.0F, -24.0F, 32.0F, 1.0F, 48.0F, new CubeDeformation(0.0F))
.texOffs(52, 61).addBox(-10.0F, -5.0F, 22.0F, 2.0F, 2.0F, 3.0F, new CubeDeformation(0.0F))
.texOffs(52, 61).addBox(8.0F, -5.0F, 22.0F, 2.0F, 2.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F));
return LayerDefinition.create(meshdefinition, 128, 128);
}
@Override
public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
}
@Override
public void renderToBuffer(PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
bb_main.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
}
}