Jump to content

Please Help. java.lang.NoSuchMethodException


Recommended Posts

Hey Guys


This is 1.7.2

I'm adding in a new mob and I have created the render class, model class, mob class as well as the client proxy and the spawn egg. However every time I try spawn the mob in game with the spawn egg I get this error in my console.



java.lang.NoSuchMethodException: tutorial.DMAexample.MyEntities.ModelmrHandy.<init>(net.minecraft.world.World)

[01:30:03] [server thread/WARN]: Skipping Entity with id 6

at java.lang.Class.getConstructor0(Class.java:2763)

at java.lang.Class.getConstructor(Class.java:1693)

at net.minecraft.entity.EntityList.createEntityByID(EntityList.java:221)

at net.minecraft.item.ItemMonsterPlacer.spawnCreature(ItemMonsterPlacer.java:173)

at net.minecraft.item.ItemMonsterPlacer.onItemUse(ItemMonsterPlacer.java:79)

at net.minecraft.item.ItemStack.tryPlaceItemIntoWorld(ItemStack.java:144)

at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:418)

at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:588)

at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74)

at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122)

at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:232)

at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:714)

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:602)

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:481)

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:739)[/i][/i][/i][/i]



The game doesn't crash but it doesn't spawn the mob.


Heres some of my code

Any help and/or examples would be much appreciated



private void registerEntity(Class<ModelmrHandyMob> entityClass, String entityName,

                        int bkEggColor, int fgEggColor) {

                int id = EntityRegistry.findGlobalUniqueEntityId();


        EntityRegistry.registerGlobalEntityID(entityClass, entityName, id);



          public void addSpawn(Class<ModelmrHandyMob> entityClass, int spawnProb, int min, int max, BiomeGenBase[] biomes) {

          if (spawnProb > 0) {

                  EntityRegistry.addSpawn(entityClass, spawnProb, min, max, EnumCreatureType.creature, biomes);






package tutorial.DMAexample.MyEntities;


import net.minecraft.client.model.ModelBase;

import net.minecraft.client.model.ModelRenderer;

import net.minecraft.entity.Entity;


public class ModelmrHandy extends ModelBase



    ModelRenderer head;

    ModelRenderer backleftarma;

    ModelRenderer backleftarmb;

    ModelRenderer fronleftarma;

    ModelRenderer frontrightarma;

    ModelRenderer backrightarma;

    ModelRenderer backrightarmb;

    ModelRenderer fromrightarmb;

    ModelRenderer frontleftarmb;


  public ModelmrHandy()


    textureWidth = 64;

    textureHeight = 32;


      head = new ModelRenderer(this, 0, 0);

      head.addBox(-4F, -8F, -4F, 12, 12, 12);

      head.setRotationPoint(0F, 0F, 0F);

      head.setTextureSize(64, 32);

      head.mirror = true;

      setRotation(head, 0F, 0F, 0F);

      backleftarma = new ModelRenderer(this, 48, 0);

      backleftarma.addBox(0F, 0F, 0F, 4, 9, 4);

      backleftarma.setRotationPoint(-1F, 0F, 5F);

      backleftarma.setTextureSize(64, 32);

      backleftarma.mirror = true;

      setRotation(backleftarma, 0.2268928F, -1.574287F, 0F);

      backleftarmb = new ModelRenderer(this, 48, 13);

      backleftarmb.addBox(0F, 0F, 0F, 4, 9, 4);

      backleftarmb.setRotationPoint(-3F, 7F, 5F);

      backleftarmb.setTextureSize(64, 32);

      backleftarmb.mirror = true;

      setRotation(backleftarmb, -0.2268928F, -1.570796F, 0F);

      fronleftarma = new ModelRenderer(this, 48, 0);

      fronleftarma.addBox(0F, 0F, 0F, 4, 9, 4);

      fronleftarma.setRotationPoint(-1F, 0F, -5F);

      fronleftarma.setTextureSize(64, 32);

      fronleftarma.mirror = true;

      setRotation(fronleftarma, 0.2268928F, -1.574287F, 0F);

      frontrightarma = new ModelRenderer(this, 48, 13);

      frontrightarma.addBox(0F, 0F, 0F, 4, 9, 4);

      frontrightarma.setRotationPoint(9F, -1F, -5F);

      frontrightarma.setTextureSize(64, 32);

      frontrightarma.mirror = true;

      setRotation(frontrightarma, -0.2268928F, -1.570796F, 0F);

      backrightarma = new ModelRenderer(this, 48, 13);

      backrightarma.addBox(0F, 0F, 0F, 4, 9, 4);

      backrightarma.setRotationPoint(9F, -1F, 5F);

      backrightarma.setTextureSize(64, 32);

      backrightarma.mirror = true;

      setRotation(backleftarma, -0.2268928F, -1.570796F, 0F);

      backrightarmb = new ModelRenderer(this, 48, 0);

      backrightarmb.addBox(0F, 0F, 0F, 4, 9, 4);

      backrightarmb.setRotationPoint(11F, 8F, 5F);

      backrightarmb.setTextureSize(64, 32);

      backrightarmb.mirror = true;

      setRotation(backleftarmb, 0.2268928F, -1.574287F, 0F);

      fromrightarmb = new ModelRenderer(this, 48, 0);

      fromrightarmb.addBox(0F, 0F, 0F, 4, 9, 4);

      fromrightarmb.setRotationPoint(11F, 8F, -5F);

      fromrightarmb.setTextureSize(64, 32);

      fromrightarmb.mirror = true;

      setRotation(fromrightarmb, 0.2268928F, -1.574287F, 0F);

      frontleftarmb = new ModelRenderer(this, 48, 13);

      frontleftarmb.addBox(0F, 0F, 0F, 4, 9, 4);

      frontleftarmb.setRotationPoint(-3F, 7F, -5F);

      frontleftarmb.setTextureSize(64, 32);

      frontleftarmb.mirror = true;

      setRotation(frontleftarmb, -0.2268928F, -1.570796F, 0F);



  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);












  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 entity)


    super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);








package tutorial.DMAexample.MyEntities;


import net.minecraft.client.model.ModelBase;

import net.minecraft.client.renderer.entity.RenderLiving;

import net.minecraft.entity.Entity;

import net.minecraft.util.ResourceLocation;


public class RenderMrHandy extends RenderLiving  {


        private static final ResourceLocation ModelmrHandy = new ResourceLocation("yourmodsname:textures/mobs/mr_handy.png");


        public RenderMrHandy(ModelBase par1ModelBase, float par2) {

                super(par1ModelBase, par2);





        protected ResourceLocation getEntityTexture(Entity var1) {


                return ModelmrHandy;






package tutorial.DMAexample.MyEntities;


import net.minecraft.block.Block;

import net.minecraft.entity.EntityAgeable;

import net.minecraft.entity.SharedMonsterAttributes;

import net.minecraft.entity.ai.EntityAIFollowParent;

import net.minecraft.entity.ai.EntityAILookIdle;

import net.minecraft.entity.ai.EntityAIMate;

import net.minecraft.entity.ai.EntityAIPanic;

import net.minecraft.entity.ai.EntityAISwimming;

import net.minecraft.entity.ai.EntityAITempt;

import net.minecraft.entity.ai.EntityAIWander;

import net.minecraft.entity.ai.EntityAIWatchClosest;

import net.minecraft.entity.passive.EntityAnimal;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.init.Items;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.world.World;


public class ModelmrHandyMob extends EntityAnimal


    private static final String __OBFID = "CL_00001640";


    public ModelmrHandyMob(World par1World)



        this.setSize(0.9F, 1.3F);


        this.tasks.addTask(0, new EntityAISwimming(this));

        this.tasks.addTask(1, new EntityAIPanic(this, 2.0D));

        this.tasks.addTask(2, new EntityAIMate(this, 1.0D));

        this.tasks.addTask(3, new EntityAITempt(this, 1.25D, Items.wheat, false));

        this.tasks.addTask(4, new EntityAIFollowParent(this, 1.25D));

        this.tasks.addTask(5, new EntityAIWander(this, 1.0D));

        this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));

        this.tasks.addTask(7, new EntityAILookIdle(this));




    * Returns true if the newer Entity AI code should be run


    public boolean isAIEnabled()


        return true;



    protected void applyEntityAttributes()








    * Returns the sound this mob makes while it's alive.


    protected String getLivingSound()


        return "mob.cow.say";




    * Returns the sound this mob makes when it is hurt.


    protected String getHurtSound()


        return "mob.cow.hurt";




    * Returns the sound this mob makes on death.


    protected String getDeathSound()


        return "mob.cow.hurt";



    protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_)


        this.playSound("mob.cow.step", 0.15F, 1.0F);




    * Returns the volume for the sounds this mob makes.


    protected float getSoundVolume()


        return 0.4F;



    protected Item getDropItem()


        return Items.leather;




    * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param

    * par2 - Level of Looting used to kill this mob.


    protected void dropFewItems(boolean par1, int par2)


        int j = this.rand.nextInt(3) + this.rand.nextInt(1 + par2);

        int k;


        for (k = 0; k < j; ++k)


            this.dropItem(Items.leather, 1);



        j = this.rand.nextInt(3) + 1 + this.rand.nextInt(1 + par2);


        for (k = 0; k < j; ++k)


            if (this.isBurning())


                this.dropItem(Items.cooked_beef, 1);




                this.dropItem(Items.beef, 1);






    * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.


    public boolean interact(EntityPlayer par1EntityPlayer)


        ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem();


        if (itemstack != null && itemstack.getItem() == Items.bucket && !par1EntityPlayer.capabilities.isCreativeMode)


            if (itemstack.stackSize-- == 1)


                par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, new ItemStack(Items.milk_bucket));


            else if (!par1EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Items.milk_bucket)))


                par1EntityPlayer.dropPlayerItemWithRandomChoice(new ItemStack(Items.milk_bucket, 1, 0), false);



            return true;




            return super.interact(par1EntityPlayer);




    public ModelmrHandyMob createChild(EntityAgeable par1EntityAgeable)


        return new ModelmrHandyMob(this.worldObj);








And again any help and/or examples will be much appreciated


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.