Jump to content

Recommended Posts

Posted

Hello again,

 

My custom mob dont want hold items in hand when SPAWN, here's the code:

package com.summonsphere.mobs;

import java.util.Calendar;
import java.util.List;
import java.util.UUID;

import com.summonsphere.items.SummonItems;
import com.summonsphere.main.mainRegistry;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
........
import net.minecraft.world.WorldProviderHell;
import net.minecraftforge.common.ForgeModContainer;

public class EntityWarrior extends EntityAnimal implements IEntityOwnable, IRangedAttackMob {

public EntityWarrior(World parWorld) {
	super(parWorld);

        this.setSize(0.6F, 1.99F);
        
        this.getNavigator().setBreakDoors(false);
        this.getNavigator().setAvoidsWater(false);
        this.getNavigator().setCanSwim(true);
        
        this.tasks.addTask(0, new EntityAISwimming(this));
        this.tasks.addTask(1, new EntityAILookIdle(this));
        this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 0.6D));
        
        this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 3.0F, 1.0F));
        this.tasks.addTask(9, new EntityAIWander(this, 0.6D));

        this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
        this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityMob.class, 0, true));
        
}

    protected void applyEntityAttributes()
    {
        super.applyEntityAttributes();
        
        this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(150.0D);
        this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.35D);
        this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(40.0D);
        //this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(5.0D);
    }
    
    protected void entityInit()
    {
        super.entityInit();
        this.dataWatcher.addObject(13, new Byte((byte)0));
        this.dataWatcher.addObject(16, Byte.valueOf((byte)0));
        this.dataWatcher.addObject(17, "");
    }

    public IEntityLivingData onSpawnWithEgg(IEntityLivingData p_110161_1_)
    {
        p_110161_1_ = super.onSpawnWithEgg(p_110161_1_);
        
        this.setCurrentItemOrArmor(0, new ItemStack(Items.stone_sword));
        
        return p_110161_1_;
    }

 

pls help ...

 

Posted

Does your Renderer handle the drawing of held items?

 

My Render class:

package com.summonsphere.mobs;

import org.lwjgl.opengl.GL11;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;

public class RenderWarrior extends RenderLiving {

private static final ResourceLocation mobTextures = new ResourceLocation("summonsphere:textures/mobs/warrior1.png");

public RenderWarrior(ModelBase par1ModelBase, float par2) {
	super(par1ModelBase, par2);

}

protected ResourceLocation getEntityTexture(EntityWarrior entity) {
	return mobTextures;
}	

protected ResourceLocation getEntityTexture(Entity entity) {
	return this.getEntityTexture((EntityWarrior)entity);
}

}

Posted

Rendering of equipped Items happens in RenderBiped. If you don't extend RenderBiped, you have to render the Items yourself.

 

thanks now i changed my class to "RenderBiped" ... but I cant register the entity:

RenderingRegistry.registerEntityRenderingHandler(EntityWarrior.class, new RenderWarrior(new Warrior(), 0));

 

Or you have an example to render the equippedItems by myself?

 

EDIT: just changed related class type :)

 

Thank you again ...

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.