3 Errors on mob with custom entity model

Started by Cyclip on

Topic category: Help with MCreator software

Joined Jan 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
3 Errors on mob with custom entity model

I created a model using Tabula and tried to use it in mcreator but it threw an error: class, interface or enum expected. I'm not good at java at all but I found out I had to remove the last curly bracket and now this comes up:

:clean
:deobfCompileDummyTask
:deobfProvidedDummyTask
:sourceApiJava
:compileApiJava UP-TO-DATE
:processApiResources UP-TO-DATE
:apiClasses UP-TO-DATE
:sourceMainJava
C:\Pylo\MCreator179\forge\build\sources\main\java\mod\mcreator\mcreator_xeredox.java:12: error: class Xeredox is public, should be declared in a file named Xeredox.java
public static class Xeredox extends ModelBase {
              ^
C:\Pylo\MCreator179\forge\build\sources\main\java\mod\mcreator\TestEnvironmentMod.java:77: error: cannot find symbol
   mcreator_xeredox mcreator_40 = new mcreator_xeredox();
   ^
  symbol:   class mcreator_xeredox
  location: class TestEnvironmentMod
C:\Pylo\MCreator179\forge\build\sources\main\java\mod\mcreator\TestEnvironmentMod.java:77: error: cannot find symbol
   mcreator_xeredox mcreator_40 = new mcreator_xeredox();
                                      ^
  symbol:   class mcreator_xeredox
  location: class TestEnvironmentMod
3 errors
:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 17.28 secs
C:\Pylo\MCreator179\forge>
Task completed with return code 0 in 18395 milliseconds

Code for the thing:

package mod.mcreator;

import net.minecraft.entity.Entity;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.model.ModelIronGolem;
import net.minecraft.client.model.ModelBase;
/**
* ModelIronGolem - Either Mojang or a mod author
* Created using Tabula 7.0.0
*/
public static class Xeredox extends ModelBase {
public ModelRenderer field_78176_b0;
public ModelRenderer field_78176_b1;
public ModelRenderer field_78174_d;
public ModelRenderer field_78177_c;
public ModelRenderer field_78176_b0_1;
public ModelRenderer field_78176_b0_2;
public ModelRenderer field_78176_b0_3;
public ModelRenderer field_78176_b0_4;
public ModelRenderer field_78176_b0_5;
public ModelRenderer field_78176_b0_6;
public ModelRenderer field_78174_d_1;
public ModelRenderer field_78174_d_2;
public ModelRenderer field_78174_d_3;
public ModelRenderer field_78174_d_4;
public Xeredox() {
this.textureWidth = 128;
this.textureHeight = 128;
this.field_78176_b0 = new ModelRenderer(this, 0, 40);
this.field_78176_b0.setRotationPoint(2.7F, -0.6F, 0.0F);
this.field_78176_b0.addBox(-9.0F, -2.0F, -6.0F, 12, 1, 11, 0.0F);
this.field_78176_b1 = new ModelRenderer(this, 0, 70);
this.field_78176_b1.setRotationPoint(0.0F, -7.0F, 0.0F);
this.field_78176_b1.addBox(-4.5F, 10.0F, -3.0F, 9, 5, 6, 0.5F);
this.field_78174_d_4 = new ModelRenderer(this, 60, 58);
this.field_78174_d_4.setRotationPoint(1.0F, -7.0F, 0.0F);
this.field_78174_d_4.addBox(9.0F, -2.5F, -3.0F, 4, 15, 6, 0.0F);
this.field_78176_b0_2 = new ModelRenderer(this, 0, 40);
this.field_78176_b0_2.setRotationPoint(0.0F, -6.0F, 0.0F);
this.field_78176_b0_2.addBox(-9.0F, -2.0F, -6.0F, 18, 1, 11, 0.0F);
this.field_78174_d_1 = new ModelRenderer(this, 60, 58);
this.field_78174_d_1.setRotationPoint(4.9F, 5.9F, 0.0F);
this.field_78174_d_1.addBox(9.0F, -2.5F, -3.0F, 2, 14, 5, 0.0F);
this.field_78174_d = new ModelRenderer(this, 60, 58);
this.field_78174_d.setRotationPoint(-25.1F, 5.9F, 0.0F);
this.field_78174_d.addBox(9.0F, -2.5F, -3.0F, 2, 14, 5, 0.0F);
this.field_78177_c = new ModelRenderer(this, 60, 21);
this.field_78177_c.setRotationPoint(-1.0F, -7.0F, 0.0F);
this.field_78177_c.addBox(-13.0F, -2.5F, -3.0F, 4, 15, 6, 0.0F);
this.field_78176_b0_3 = new ModelRenderer(this, 0, 40);
this.field_78176_b0_3.setRotationPoint(0.0F, -6.0F, 0.0F);
this.field_78176_b0_3.addBox(-9.0F, -2.0F, -6.0F, 18, 1, 11, 0.0F);
this.field_78174_d_3 = new ModelRenderer(this, 60, 58);
this.field_78174_d_3.setRotationPoint(-19.1F, 5.9F, 0.0F);
this.field_78174_d_3.addBox(9.0F, -2.5F, -3.0F, 2, 14, 5, 0.0F);
this.field_78174_d_2 = new ModelRenderer(this, 60, 58);
this.field_78174_d_2.setRotationPoint(-0.9F, 5.9F, 0.0F);
this.field_78174_d_2.addBox(9.0F, -2.5F, -3.0F, 2, 14, 5, 0.0F);
this.field_78176_b0_4 = new ModelRenderer(this, 0, 40);
this.field_78176_b0_4.setRotationPoint(1.7F, 1.4F, 0.0F);
this.field_78176_b0_4.addBox(-9.0F, -2.0F, -6.0F, 14, 1, 11, 0.0F);
this.field_78176_b0_5 = new ModelRenderer(this, 0, 40);
this.field_78176_b0_5.setRotationPoint(1.7F, -4.4F, 0.0F);
this.field_78176_b0_5.addBox(-9.0F, -2.0F, -6.0F, 14, 1, 11, 0.0F);
this.field_78176_b0_1 = new ModelRenderer(this, 0, 40);
this.field_78176_b0_1.setRotationPoint(0.0F, 2.9F, 0.0F);
this.field_78176_b0_1.addBox(-9.0F, -2.0F, -6.0F, 18, 1, 11, 0.0F);
this.field_78176_b0_6 = new ModelRenderer(this, 0, 40);
this.field_78176_b0_6.setRotationPoint(2.7F, -2.6F, 0.0F);
this.field_78176_b0_6.addBox(-9.0F, -2.0F, -6.0F, 12, 1, 11, 0.0F);
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
this.field_78176_b0.render(f5);
this.field_78176_b1.render(f5);
this.field_78174_d_4.render(f5);
this.field_78176_b0_2.render(f5);
this.field_78174_d_1.render(f5);
this.field_78174_d.render(f5);
this.field_78177_c.render(f5);
this.field_78176_b0_3.render(f5);
this.field_78174_d_3.render(f5);
this.field_78174_d_2.render(f5);
this.field_78176_b0_4.render(f5);
this.field_78176_b0_5.render(f5);
this.field_78176_b0_1.render(f5);
this.field_78176_b0_6.render(f5);
}
/**
* This is a helper function from Tabula to set the rotation of model parts
*/
public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
}
 

I don't understand java that much (to the point where I don't know what difference a public or static class does)

Thanks :D

Joined Feb 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
1. You need to remove…
Tue, 07/17/2018 - 02:38

1. You need to remove another curly bracket

public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
} <--

2 & 3.I don't know but I think this forum could help you : https://mcreator.net/forum/35866/how-get-tabula-models-work-mcreator-mi…; I believe you're missing some imports for tabula and a lot of behavior code (how he'll react cuz if not, all you'll have is a non-functionnal and non-spawnable mob that might crash your game or not even exist in it).

 

Here's my code as reference for what I mean by *you're missing a lot of code* (Model made with Technee):

 

import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.common.registry.EntityRegistry;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.client.registry.RenderingRegistry;

import net.minecraft.world.biome.Biome;
import net.minecraft.world.World;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.EnumHand;
import net.minecraft.util.DamageSource;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAIAttackMelee;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.entity.Entity;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.Minecraft;

import java.util.Random;
import java.util.Iterator;
import java.util.ArrayList;

@SuppressWarnings("unchecked")
public class mcreator_angel {

    public int mobid = 45;
    public static Object instance;

    public void load(FMLInitializationEvent event) {
    }

    public void generateNether(World world, Random random, int chunkX, int chunkZ) {
    }

    public void generateSurface(World world, Random random, int chunkX, int chunkZ) {
    }

    public int addFuel(ItemStack fuel) {
        return 0;
    }

    @SideOnly(Side.CLIENT)
    public void registerRenderers() {
        RenderLiving customRender = new RenderLiving(Minecraft.getMinecraft().getRenderManager(), new mcreator_angel.ModelAngel(), 0) {
            protected ResourceLocation getEntityTexture(Entity par1Entity) {
                return new ResourceLocation("Angel.png");
            }
        };
        RenderingRegistry.registerEntityRenderingHandler(mcreator_angel.Entityangel.class, customRender);

    }

    public void serverLoad(FMLServerStartingEvent event) {
    }

    public void preInit(FMLPreInitializationEvent event) {
        EntityRegistry.registerModEntity(new ResourceLocation("testenvironmentmod:angel"), mcreator_angel.Entityangel.class, "angel", mobid,
                instance, 64, 1, true, (255 << 16) + (255 << 8) + 255, (255 << 16) + (255 << 8) + 255);

        EntityRegistry.addSpawn(mcreator_angel.Entityangel.class, 9, 0, 30, EnumCreatureType.MONSTER, new Biome[]{mcreator_angelbiome.biome,});

    }

    public static Biome[] allbiomes(net.minecraft.util.registry.RegistryNamespaced<ResourceLocation, Biome> in) {
        Iterator<Biome> itr = in.iterator();
        ArrayList<Biome> ls = new ArrayList<Biome>();
        while (itr.hasNext()) {
            ls.add(itr.next());
        }
        return ls.toArray(new Biome[ls.size()]);
    }

    public static class Entityangel extends EntityMob {
        World world = null;

        public Entityangel(World var1) {
            super(var1);
            world = var1;
            experienceValue = 5;
            this.isImmuneToFire = true;
            addRandomArmor();
            setNoAI(!true);

            this.tasks.addTask(6, new EntityAIWander(this, 0.8D));
            this.tasks.addTask(7, new EntityAISwimming(this));
            this.tasks.addTask(4, new EntityAILookIdle(this));
            this.targetTasks.addTask(16, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
            this.targetTasks.addTask(17, new EntityAIHurtByTarget(this, false));
            this.tasks.addTask(15, new EntityAIAttackMelee(this, 1.0D, false));
            this.tasks.addTask(14, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));

        }

        protected void applyEntityAttributes() {
            super.applyEntityAttributes();
            this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.65D);
            this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(300D);
            if (this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE) != null)
                this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(30D);
        }

        protected void addRandomArmor() {

        }

        @Override
        protected Item getDropItem() {
            return null;
        }

        @Override
        protected net.minecraft.util.SoundEvent getAmbientSound() {
            return (net.minecraft.util.SoundEvent) net.minecraft.util.SoundEvent.REGISTRY.getObject(new ResourceLocation(""));
        }

        @Override
        protected net.minecraft.util.SoundEvent getHurtSound(DamageSource ds) {
            return (net.minecraft.util.SoundEvent) net.minecraft.util.SoundEvent.REGISTRY.getObject(new ResourceLocation("game.neutral.hurt"));
        }

        @Override
        protected net.minecraft.util.SoundEvent getDeathSound() {
            return (net.minecraft.util.SoundEvent) net.minecraft.util.SoundEvent.REGISTRY.getObject(new ResourceLocation("game.neutral.die"));
        }

        @Override
        public void onStruckByLightning(EntityLightningBolt entityLightningBolt) {
            super.onStruckByLightning(entityLightningBolt);
            int i = (int) this.posX;
            int j = (int) this.posY;
            int k = (int) this.posZ;
            Entity entity = this;

        }

        @Override
        public void fall(float l, float d) {
            super.fall(l, d);
            int i = (int) this.posX;
            int j = (int) this.posY;
            int k = (int) this.posZ;
            super.fall(l, d);
            Entity entity = this;

        }

        @Override
        public void onDeath(DamageSource source) {
            super.onDeath(source);
            int i = (int) this.posX;
            int j = (int) this.posY;
            int k = (int) this.posZ;
            Entity entity = this;

        }

        @Override
        public boolean processInteract(EntityPlayer entity, EnumHand hand) {
            super.processInteract(entity, hand);
            int i = (int) this.posX;
            int j = (int) this.posY;
            int k = (int) this.posZ;

            return true;
        }

        @Override
        protected float getSoundVolume() {
            return 1.0F;
        }

    }

    // Date: 2017-02-04 16:23:41
    // Template version 1.1
    // Java generated by Techne
    // Keep in mind that you still need to fill in some blanks
    // - ZeuX

    public static class ModelAngel extends ModelBase {
        // fields
        ModelRenderer head;
        ModelRenderer body;
        ModelRenderer rightarm;
        ModelRenderer leftarm;
        ModelRenderer rightleg;
        ModelRenderer leftleg;
        ModelRenderer wing1;
        ModelRenderer wing2;

        public ModelAngel() {
            textureWidth = 64;
            textureHeight = 64;

            head = new ModelRenderer(this, 0, 0);
            head.addBox(-4F, -8F, -4F, 8, 8, 8);
            head.setRotationPoint(0F, 0F, 0F);
            head.setTextureSize(64, 64);
            head.mirror = true;
            setRotation(head, 0F, 0F, 0F);
            body = new ModelRenderer(this, 16, 16);
            body.addBox(-4F, 0F, -2F, 8, 12, 4);
            body.setRotationPoint(0F, 0F, 0F);
            body.setTextureSize(64, 64);
            body.mirror = true;
            setRotation(body, 0F, 0F, 0F);
            rightarm = new ModelRenderer(this, 40, 16);
            rightarm.addBox(-3F, -2F, -2F, 4, 12, 4);
            rightarm.setRotationPoint(-5F, 2F, 0F);
            rightarm.setTextureSize(64, 64);
            rightarm.mirror = true;
            setRotation(rightarm, 0F, 0F, 0F);
            leftarm = new ModelRenderer(this, 40, 16);
            leftarm.addBox(-1F, -2F, -2F, 4, 12, 4);
            leftarm.setRotationPoint(5F, 2F, 0F);
            leftarm.setTextureSize(64, 64);
            leftarm.mirror = true;
            setRotation(leftarm, 0F, 0F, 0F);
            rightleg = new ModelRenderer(this, 0, 16);
            rightleg.addBox(-2F, 0F, -2F, 4, 12, 4);
            rightleg.setRotationPoint(-2F, 12F, 0F);
            rightleg.setTextureSize(64, 64);
            rightleg.mirror = true;
            setRotation(rightleg, 0F, 0F, 0F);
            leftleg = new ModelRenderer(this, 0, 16);
            leftleg.addBox(-2F, 0F, -2F, 4, 12, 4);
            leftleg.setRotationPoint(2F, 12F, 0F);
            leftleg.setTextureSize(64, 64);
            leftleg.mirror = true;
            setRotation(leftleg, 0F, 0F, 0F);
            wing1 = new ModelRenderer(this, 0, 48);
            wing1.addBox(0F, 0F, 0F, 28, 15, 1);
            wing1.setRotationPoint(3F, 1F, 2F);
            wing1.setTextureSize(64, 64);
            wing1.mirror = true;
            setRotation(wing1, 0.2974289F, -0.3490659F, -0.3717861F);
            wing2 = new ModelRenderer(this, 0, 48);
            wing2.addBox(0F, 0F, 0F, 28, 15, 1);
            wing2.setRotationPoint(-3F, 1F, 3F);
            wing2.setTextureSize(64, 64);
            wing2.mirror = true;
            setRotation(wing2, 2.918521F, 0.5105794F, -2.732628F);
        }

        public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
            super.render(entity, f, f1, f2, f3, f4, f5);
            setRotationAngles(f, f1, f2, f3, f4, f5, entity);

            head.render(f5);
            body.render(f5);
            rightarm.render(f5);
            leftarm.render(f5);
            rightleg.render(f5);
            leftleg.render(f5);
            wing1.render(f5);
            wing2.render(f5);
        }

        private void setRotation(ModelRenderer model, float x, float y, float z) {
            model.rotateAngleX = x;
            model.rotateAngleY = y;
            model.rotateAngleZ = z;
        }

        public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity e)

        {
            super.setRotationAngles(f, f1, f2, f3, f4, f5, e);
            this.head.rotateAngleY = f3 / (180F / (float) Math.PI);
            this.head.rotateAngleX = f4 / (180F / (float) Math.PI);
            this.leftleg.rotateAngleX = MathHelper.cos(f * 1.0F) * -1.0F * f1;
            this.rightleg.rotateAngleX = MathHelper.cos(f * 1.0F) * 1.0F * f1;
            this.rightarm.rotateAngleX = MathHelper.cos(f * 0.6662F + (float) Math.PI) * 2.0F * f1 * 0.5F;
            this.leftarm.rotateAngleX = MathHelper.cos(f * 0.6662F) * 2.0F * f1 * 0.5F;
        }

    }

}