Jump to content

Recommended Posts

Posted

i want to create an entity without any ai or tasks, i want it just to (awkwardly) stand

i have never done entities(except model) so can anyone tell me which classes i need, cause im really confused after looking into vanilla files...

"The cycle of life and death continues. We will live, they will die."

Posted

If you mean "entity" as it is - then you can even extend Entity.class and Override needed methods (for example look at EntityItem.class which is literally "awkwardly standing" entity).

 

If you mean entity as living thing - you simply can extend EntityLivingBase for most basic living thing. For it to not have tasks - you can simply not add them :P

 

Rest of classes, such as Mob, Monster, Animal, etc. are abstract stuff implemented as base of some entitie's groups (cows, chickens, pigs are Animals for example).

 

In your case I'd go with EntityLivingBase since you want total-pure thing (or Entity.class as mentioned before if you don't want it to live).

1.7.10 is no longer supported by forge, you are on your own.

Posted

So, I've created my entity class:

package neko.Kudo.entity.passive;

import java.util.Calendar;

import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIBase;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.passive.EntityAmbientCreature;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntitySmallFireball;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.BlockPos;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class EntityMeep extends Entity{

public EntityMeep(World worldIn, double x, double y, double z){
	super(worldIn);
	this.setPosition(x, y, z);
}

@Override
protected void entityInit(){
        this.getDataWatcher().addObjectByDataType(10, 5);
    }

@Override
protected void readEntityFromNBT(NBTTagCompound tagCompund) {

}

@Override
protected void writeEntityToNBT(NBTTagCompound tagCompound) {

}
    
}

 

and renderer:

public class RenderMeep extends Render{

private static final ResourceLocation meeptexture = new ResourceLocation("textures/entity/meep/meep.png");

public RenderMeep(RenderManager rendermanager, ModelBase model, float shadowsize) {
	super(rendermanager);
}

protected ResourceLocation getEntityTexture(EntityMeep entity) {
	return meeptexture;
}

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

}
}

and model:

public class ModelMeep extends ModelBase{
public ModelRenderer core = new ModelRenderer(this, 0, 0);
public ModelRenderer outercore;
public ModelRenderer aura;

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

	this.core = new ModelRenderer(this, 0, 0);
    this.core.addBox(-4F, -4F, -4F, 8, 8, ;
    this.core.setRotationPoint(0F, 16F, 0F);
    
    this.outercore = new ModelRenderer(this, 0, 16);
    this.outercore.addBox(-3F, -3F, -3F, 6, 6, 6);
    this.outercore.setRotationPoint(0F, 16F, 0F);

	this.aura = new ModelRenderer(this, 32, 0);
	this.aura.addBox(-2F, -2F, -2F, 4, 4, 4);
    this.aura.setRotationPoint(0F, 16F, 0F);


}

 public void render(Entity entity, float time, float limbs, float p_78088_4_, float heady, float headx, float ytrans){
      this.setRotationAngles(time, limbs, p_78088_4_, heady, headx, ytrans, entity);
      this.core.render(ytrans);
      this.outercore.render(ytrans);
      this.aura.render(ytrans);

    }

  public void setRotationAngles(float time, float limbs, float p_78087_3_, float heady, float headx, float p_78087_6_, Entity entity){
	  float f6 = p_78087_3_ * (float)Math.PI * -0.1F;
        int i;

        for (i = 0; i < 4; ++i)
        {
            this.aura.rotationPointY = -2.0F + MathHelper.cos(((float)(i * 2) + p_78087_3_) * 0.25F);
            this.aura.rotationPointX = MathHelper.cos(f6) * 9.0F;
            this.aura.rotationPointZ = MathHelper.sin(f6) * 9.0F;
            ++f6;
        }

        f6 = ((float)Math.PI / 4F) + p_78087_3_ * (float)Math.PI * 0.03F;

        for (i = 4; i < 8; ++i)
        {
            this.aura.rotationPointY = 2.0F + MathHelper.cos(((float)(i * 2) + p_78087_3_) * 0.25F);
            this.aura.rotationPointX = MathHelper.cos(f6) * 7.0F;
            this.aura.rotationPointZ = MathHelper.sin(f6) * 7.0F;
            ++f6;
        }

        f6 = 0.47123894F + p_78087_3_ * (float)Math.PI * -0.05F;

        for (i = 8; i < 12; ++i)
        {
            this.aura.rotationPointY = 11.0F + MathHelper.cos(((float)i * 1.5F + p_78087_3_) * 0.5F);
            this.aura.rotationPointX = MathHelper.cos(f6) * 5.0F;
            this.aura.rotationPointZ = MathHelper.sin(f6) * 5.0F;
            ++f6;
    }
  
  }

}

now what ._.

"The cycle of life and death continues. We will live, they will die."

Posted

In PreInit:

EntityRegistry.registerModEntity(EntityClazz.class, "Name", ID, ModID, trackingRangeInBlocks, positionUpdateFrequency, velocityUpdates);

 

positionUpdateFrequency should be "3", no point in making it faster.

velocityUpdates should be used with throwables and other thing that need velocity to know how to move.

 

As to model - in Init, inside client proxy:

RenderingRegistry.registerEntityRenderingHandler(EntityClass.class, new RenderEntityClass(Minecraft.getMinecraft().getRenderManager()));

 

P.S: You could seriously find it in 1st google search tutorial. Look next time, there are plenty :D

1.7.10 is no longer supported by forge, you are on your own.

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.