Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

 

  • Author

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

}

  • Author

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.