Jump to content

Second Custom Mob Is White Column!


Setlock

Recommended Posts

well here let me paste my code

this is my first one that works (don't ask about the name of the mobs)

    registerEntity(woolmanMob.class, "woolman", 0xeaeae8, 0xc99a13);}

   

   

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

                            int bkEggColor, int fgEggColor) {

                    int id = EntityRegistry.findGlobalUniqueEntityId();

   

            EntityRegistry.registerGlobalEntityID(entityClass, entityName, id);

            EntityList.entityEggs.put(Integer.valueOf(id), new EntityEggInfo(id, bkEggColor, fgEggColor));

            }

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

              if (spawnProb > 0) {

                      EntityRegistry.addSpawn(woolmanMob.class, 10, 2, 4, EnumCreatureType.creature, BiomeGenBase.plains, BiomeGenBase.desert, BiomeGenBase.forest, BiomeGenBase.forestHills);

              }

              }

              {

 

AND THIS IS THE SECOND! That Doesn't Work!

 

registerEntity1(woolyMob.class, "wooly", 0x3c768c, 0xb0000);}

private void registerEntity1(Class<woolyMob> entityClass, String entityName,

                        int bkEggColor, int fgEggColor) {

                int id = EntityRegistry.findGlobalUniqueEntityId();

 

        EntityRegistry.registerGlobalEntityID(entityClass, entityName, id);

        EntityList.entityEggs.put(Integer.valueOf(id), new EntityEggInfo(id, bkEggColor, fgEggColor));

        }

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

          if (spawnProb > 0) {

                  EntityRegistry.addSpawn(woolyMob.class, 10, 2, 4, EnumCreatureType.creature);

          }

          }

}

 

 

This is all in my main class file...If you need my Render(mobname), (mobname.java) or (mobname)Mob just tell me

Link to comment
Share on other sites

Well I'll just show the rest of my code: This code is for the second mob that doesn't work

Main Mob Class

 

import net.minecraft.client.model.ModelBase;

import net.minecraft.client.model.ModelRenderer;

import net.minecraft.entity.Entity;

 

public class wooly extends ModelBase

{

  //fields

    ModelRenderer head;

    ModelRenderer body;

    ModelRenderer leg1;

    ModelRenderer leg2;

    ModelRenderer leg3;

    ModelRenderer leg4;

    ModelRenderer horn1;

    ModelRenderer horn2;

    ModelRenderer udders;

 

  public wooly()

  {

    textureWidth = 64;

    textureHeight = 32;

   

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

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

      head.setRotationPoint(0F, 4F, -8F);

      head.setTextureSize(64, 32);

      head.mirror = true;

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

      body = new ModelRenderer(this, 18, 4);

      body.addBox(-6F, -10F, -7F, 12, 18, 10);

      body.setRotationPoint(0F, 5F, 2F);

      body.setTextureSize(64, 32);

      body.mirror = true;

      setRotation(body, 1.570796F, 0F, 0F);

      leg1 = new ModelRenderer(this, 0, 16);

      leg1.addBox(-3F, 0F, -2F, 4, 12, 4);

      leg1.setRotationPoint(-3F, 12F, 7F);

      leg1.setTextureSize(64, 32);

      leg1.mirror = true;

      setRotation(leg1, 0F, 0F, 0F);

      leg2 = new ModelRenderer(this, 0, 16);

      leg2.addBox(-1F, 0F, -2F, 4, 12, 4);

      leg2.setRotationPoint(3F, 12F, 7F);

      leg2.setTextureSize(64, 32);

      leg2.mirror = true;

      setRotation(leg2, 0F, 0F, 0F);

      leg3 = new ModelRenderer(this, 0, 16);

      leg3.addBox(-3F, 0F, -3F, 4, 12, 4);

      leg3.setRotationPoint(-3F, 12F, -5F);

      leg3.setTextureSize(64, 32);

      leg3.mirror = true;

      setRotation(leg3, 0F, 0F, 0F);

      leg4 = new ModelRenderer(this, 0, 16);

      leg4.addBox(-1F, 0F, -3F, 4, 12, 4);

      leg4.setRotationPoint(3F, 12F, -5F);

      leg4.setTextureSize(64, 32);

      leg4.mirror = true;

      setRotation(leg4, 0F, 0F, 0F);

      horn1 = new ModelRenderer(this, 22, 0);

      horn1.addBox(-4F, -5F, -4F, 1, 3, 1);

      horn1.setRotationPoint(0F, 3F, -7F);

      horn1.setTextureSize(64, 32);

      horn1.mirror = true;

      setRotation(horn1, 0F, 0F, 0F);

      horn2 = new ModelRenderer(this, 22, 0);

      horn2.addBox(3F, -5F, -4F, 1, 3, 1);

      horn2.setRotationPoint(0F, 3F, -7F);

      horn2.setTextureSize(64, 32);

      horn2.mirror = true;

      setRotation(horn2, 0F, 0F, 0F);

      udders = new ModelRenderer(this, 52, 0);

      udders.addBox(-2F, -3F, 0F, 4, 6, 2);

      udders.setRotationPoint(0F, 14F, 6F);

      udders.setTextureSize(64, 32);

      udders.mirror = true;

      setRotation(udders, 1.570796F, 0F, 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);

    head.render(f5);

    body.render(f5);

    leg1.render(f5);

    leg2.render(f5);

    leg3.render(f5);

    leg4.render(f5);

    horn1.render(f5);

    horn2.render(f5);

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

  {

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

  }

 

}

 

 

 

 

 

 

 

 

 

 

 

THEN HERE IS THE Render(MobName)

 

 

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 Renderwooly extends RenderLiving  {

     

      private static final ResourceLocation wooly = new ResourceLocation("woolmod:textures/mobs/wooly.png");

     

      public Renderwooly(ModelBase par1ModelBase, float par2) {

              super(par1ModelBase, par2);

             

      }

 

@Override

protected ResourceLocation getEntityTexture(Entity arg0) {

 

return wooly;

 

}

}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

And Finally (mobname)Mob

 

import java.util.Calendar;

import java.util.Random;

 

 

 

 

import cpw.mods.fml.common.registry.EntityRegistry;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.block.Block;

import net.minecraft.client.model.ModelBase;

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

import net.minecraft.entity.Entity;

import net.minecraft.entity.EnumCreatureAttribute;

import net.minecraft.entity.EnumCreatureType;

import net.minecraft.entity.IEntityLivingData;

import net.minecraft.entity.SharedMonsterAttributes;

import net.minecraft.entity.ai.EntityAIAttackOnCollide;

import net.minecraft.entity.ai.EntityAIBreakDoor;

import net.minecraft.entity.ai.EntityAIHurtByTarget;

import net.minecraft.entity.ai.EntityAILookIdle;

import net.minecraft.entity.ai.EntityAIMoveThroughVillage;

import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction;

import net.minecraft.entity.ai.EntityAINearestAttackableTarget;

import net.minecraft.entity.ai.EntityAISwimming;

import net.minecraft.entity.ai.EntityAIWander;

import net.minecraft.entity.ai.EntityAIWatchClosest;

import net.minecraft.entity.ai.attributes.AttributeModifier;

import net.minecraft.entity.ai.attributes.IAttribute;

import net.minecraft.entity.ai.attributes.RangedAttribute;

import net.minecraft.entity.monster.EntityMob;

import net.minecraft.entity.monster.EntitySkeleton;

import net.minecraft.entity.monster.EntityZombie;

import net.minecraft.entity.passive.EntityVillager;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.init.Blocks;

import net.minecraft.init.Items;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.potion.Potion;

import net.minecraft.potion.PotionEffect;

import net.minecraft.util.MathHelper;

import net.minecraft.util.ResourceLocation;

import net.minecraft.world.EnumDifficulty;

import net.minecraft.world.World;

import net.minecraft.world.biome.BiomeGenBase;

import net.minecraftforge.common.ForgeModContainer;

 

public class woolyMob extends EntityMob

{

    protected static final IAttribute field_110186_bp = (new RangedAttribute("zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).setDescription("Spawn Reinforcements Chance");

    private final EntityAIBreakDoor field_146075_bs = new EntityAIBreakDoor(this);

    private static final String __OBFID = "CL_00001699";

    private boolean field_146076_bu = false;

    private float field_146074_bv = -1.0F;

    private float field_146073_bw;

 

    public woolyMob(World par1World)

    {

        super(par1World);

        this.getNavigator().setBreakDoors(true);

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

        this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false));

        this.tasks.addTask(4, new EntityAIAttackOnCollide(this, EntityVillager.class, 1.0D, true));

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

        this.tasks.addTask(6, new EntityAIMoveThroughVillage(this, 1.0D, false));

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

        this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));

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

        this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));

        this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));

        this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, 0, false));

        this.setSize(0.6F, 1.8F);

    }

 

    protected void entityInit()

    {

        super.entityInit();

        this.getDataWatcher().addObject(12, Byte.valueOf((byte)0));

        this.getDataWatcher().addObject(13, Byte.valueOf((byte)0));

        this.getDataWatcher().addObject(14, Byte.valueOf((byte)0));

    }

 

    /**

    * Called to update the entity's position/logic.

    */

    public void onUpdate()

    {

        super.onUpdate();

    }

 

    protected void applyEntityAttributes()

    {

        super.applyEntityAttributes();

        this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(25.0D);

        this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.0D);

        this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(40.0D);

        this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.0D);

        this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2.0D);

    }

 

    /**

    * Finds the closest player within 16 blocks to attack, or null if this Entity isn't interested in attacking

    * (Animals, Spiders at day, peaceful PigZombies).

    */

    protected Entity findPlayerToAttack()

    {

        float f = this.getBrightness(1.0F);

 

        if (f < 0.5F)

        {

            double d0 = 16.0D;

            return this.worldObj.getClosestVulnerablePlayerToEntity(this, d0);

        }

        else

        {

            return null;

        }

    }

 

    /**

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

    */

    protected String getLivingSound()

    {

        return "mob.sheep.say";

    }

 

    /**

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

    */

    protected String getHurtSound()

    {

        return "mob.pig.say";

    }

 

    /**

    * Returns the sound this mob makes on death.

    */

    protected String getDeathSound()

    {

        return "mob.pig.death";

    }

 

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

    {

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

    }

 

    /**

    * Basic mob attack. Default to touch of death in EntityCreature. Overridden by each mob to define their attack.

    */

    protected void attackEntity(Entity par1Entity, float par2)

    {

        float f1 = this.getBrightness(1.0F);

 

        if (f1 > 0.5F && this.rand.nextInt(100) == 0)

        {

            this.entityToAttack = null;

        }

        else

        {

            if (par2 > 2.0F && par2 < 6.0F && this.rand.nextInt(10) == 0)

            {

                if (this.onGround)

                {

                    double d0 = par1Entity.posX - this.posX;

                    double d1 = par1Entity.posZ - this.posZ;

                    float f2 = MathHelper.sqrt_double(d0 * d0 + d1 * d1);

                    this.motionX = d0 / (double)f2 * 0.5D * 0.800000011920929D + this.motionX * 0.20000000298023224D;

                    this.motionZ = d1 / (double)f2 * 0.5D * 0.800000011920929D + this.motionZ * 0.20000000298023224D;

                    this.motionY = 0.0000000059604645D;

                    EntityRegistry.addSpawn(woolyMob.class, 10, 2, 4, EnumCreatureType.creature);

                }

            }

            else

            {

                super.attackEntity(par1Entity, par2);

            }

        }

    }

 

    protected Block getDropBlock()

    {

        return Blocks.wool;

    }

    /**

    * Get this Entity's EnumCreatureAttribute

    */

    public EnumCreatureAttribute getCreatureAttribute()

    {

        return EnumCreatureAttribute.UNDEAD;

    }

 

    protected void dropRareDrop(int par1)

    {

        switch (this.rand.nextInt(3))

        {

            case 0:

                this.dropItem(Items.iron_ingot, 1);

                break;

            case 1:

                this.dropItem(Items.carrot, 1);

                break;

            case 2:

                this.dropItem(Items.potato, 1);

        }

    }

 

    public boolean isPotionApplicable(PotionEffect par1PotionEffect)

    {

        return par1PotionEffect.getPotionID() == Potion.poison.id ? false : super.isPotionApplicable(par1PotionEffect);

    }

    public boolean func_146072_bX()

    {

        return this.field_146076_bu;

    }

 

    public void func_146070_a(boolean p_146070_1_)

    {

        if (this.field_146076_bu != p_146070_1_)

        {

            this.field_146076_bu = p_146070_1_;

 

            if (p_146070_1_)

            {

                this.tasks.addTask(1, this.field_146075_bs);

            }

            else

            {

                this.tasks.removeTask(this.field_146075_bs);

            }

        }

    }

 

    public IEntityLivingData onSpawnWithEgg(IEntityLivingData par1EntityLivingData)

    {

        Object par1EntityLivingData1 = super.onSpawnWithEgg(par1EntityLivingData);

        float f = this.worldObj.func_147462_b(this.posX, this.posY, this.posZ);

        this.setCanPickUpLoot(this.rand.nextFloat() < 0.55F * f);

     

        if (par1EntityLivingData1 == null)

        {

            par1EntityLivingData1 = new woolyMob.GroupData(this.worldObj.rand.nextFloat() < ForgeModContainer.zombieBabyChance, this.worldObj.rand.nextFloat() < 0.05F, null);

        }

 

        if (par1EntityLivingData1 instanceof woolyMob.GroupData)

        {

                woolyMob.GroupData groupdata = (woolyMob.GroupData)par1EntityLivingData1;

 

        }

 

        this.func_146070_a(this.rand.nextFloat() < f * 0.1F);

        this.addRandomArmor();

        this.enchantEquipment();

       

 

        if (this.getEquipmentInSlot(4) == null)

        {

            Calendar calendar = this.worldObj.getCurrentDate();

 

            if (calendar.get(2) + 1 == 10 && calendar.get(5) == 31 && this.rand.nextFloat() < 0.25F)

            {

                this.setCurrentItemOrArmor(4, new ItemStack(this.rand.nextFloat() < 0.1F ? Blocks.lit_pumpkin : Blocks.pumpkin));

                this.equipmentDropChances[4] = 0.0F;

            }

        }

 

        this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).applyModifier(new AttributeModifier("Random spawn bonus", this.rand.nextDouble() * 0.05000000074505806D, 0));

        double d0 = this.rand.nextDouble() * 1.5D * (double)this.worldObj.func_147462_b(this.posX, this.posY, this.posZ);

 

        if (d0 > 1.0D)

        {

            this.getEntityAttribute(SharedMonsterAttributes.followRange).applyModifier(new AttributeModifier("Random zombie-spawn bonus", d0, 2));

        }

 

        if (this.rand.nextFloat() < f * 0.05F)

        {

            this.getEntityAttribute(field_110186_bp).applyModifier(new AttributeModifier("Leader zombie bonus", this.rand.nextDouble() * 0.25D + 0.5D, 0));

            this.getEntityAttribute(SharedMonsterAttributes.maxHealth).applyModifier(new AttributeModifier("Leader zombie bonus", this.rand.nextDouble() * 3.0D + 1.0D, 2));

            this.func_146070_a(true);

        }

 

        return (IEntityLivingData)par1EntityLivingData1;

    }

    protected final void setSize(float par1, float par2)

    {

        boolean flag = this.field_146074_bv > 0.0F && this.field_146073_bw > 0.0F;

        this.field_146074_bv = par1;

        this.field_146073_bw = par2;

 

        if (!flag)

        {

            this.func_146069_a(1.0F);

        }

    }

 

    protected final void func_146069_a(float p_146069_1_)

    {

        super.setSize(this.field_146074_bv * p_146069_1_, this.field_146073_bw * p_146069_1_);

    }

 

    class GroupData implements IEntityLivingData

    {

        public boolean field_142048_a;

        public boolean field_142046_b;

        private static final String __OBFID = "CL_00001704";

 

        private GroupData(boolean par2, boolean par3)

        {

            this.field_142048_a = false;

            this.field_142046_b = false;

            this.field_142048_a = par2;

            this.field_142046_b = par3;

        }

 

        GroupData(boolean par2, boolean par3, Object par4EntityZombieINNER1)

        {

            this(par2, par3);

        }

    }

 

}

 

Link to comment
Share on other sites

Okay, in none of that code is the model and renderer associated with your mob.  How is Minecraft Forge supposed to know that that model goes with that renderer goes with that mob class?

 

You need to register the renderer (not just register the mob).  You need code in your ClientProxy that does something like this:

RenderingRegistry.registerEntityRenderingHandler(woolyMob.class, new Renderwooly(new wooly(), 0.5F));

 

By the way, you're not naming your classes properly.  First of all they should be properly capitalized: WoolyMob not woolyMob, Wooly instead of wooly, and RenderWooly instead of Renderwooly.  Also you should probably name the model class better, like ModelWooly.

 

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

In that code you don't show where you registerer the renderer.  Somewhere you need to associate the model with the renderer (which binds the texture), with the mob class.  Please show that code.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

whats really funny that i just found out in my proxyclient I did the registerrendering thing for my first mob but forgot to for my second, and of course now it works so thank you, i also have one more question how would i make my mobs spawn naturally in the world?

 

Link to comment
Share on other sites

That needs to go in the main class (i think the init method, not sure)

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

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.

Guest
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.

Announcements



×
×
  • Create New...

Important Information

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