Jump to content

Recommended Posts

Posted

Hello guys. I have more questions about modding. Now its about mob. Questions is:

 

1. How to make my mob standing still on one place.

2. How to make my mob not turning around ( standing still ). So he wont get from that point, i spawned him on, and only when i get close to him, he starts attack, but only from one side. Its kinda attacking tree, when you get near, it attacks. But only from one side.

3. How to make my mob immortal and not jumping out when i hit him. So its like unbreakable entity standing on place, but can attack.

Please help meh :)

Posted

"Standing still" is the lack of code.  You don't have to do a damn thing to get something to stay still.

Turning around is controlled by an AI task, I believe its called EntityAITaskLookAt or something similar.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

"Standing still" is the lack of code.  You don't have to do a damn thing to get something to stay still.

Turning around is controlled by an AI task, I believe its called EntityAITaskLookAt or something similar.

 

Here is my code of EntityName file. I removed alot of tags but that thing still rotating. How to make it just non movable? Maybe it suppose to be not mob, just entity with tags of attacking?

 

 

 

 

package doorcloser.modding;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.client.Minecraft;

import net.minecraft.client.model.ModelBase;

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

import net.minecraft.entity.Entity;

import net.minecraft.entity.ai.EntityAIAttackOnCollide;

import net.minecraft.entity.ai.EntityAIHurtByTarget;

import net.minecraft.entity.ai.EntityAILeapAtTarget;

import net.minecraft.entity.ai.EntityAILookIdle;

import net.minecraft.entity.ai.EntityAIMoveTwardsRestriction;

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

import net.minecraft.entity.monster.EntityMob;

import net.minecraft.entity.passive.EntityVillager;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.nbt.NBTTagCompound;

import net.minecraft.pathfinding.PathEntity;

import net.minecraft.util.DamageSource;

import net.minecraft.world.World;

 

public class EntityXenTree extends EntityMob {

private int attackTimer;

// mob

public EntityXenTree(World par1World) {

 

super(par1World);

this.setSize(1.0F, 2.6F);

 

texture = "/mob/HL/XenTree.png";

isImmuneToFire = true;

// mob's ai below

 

 

this.tasks.addTask(0, new EntityAIAttackOnCollide(this, EntityPlayer.class, this.moveSpeed, false));

 

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

 

 

}

 

protected boolean isAIEnabled()// enable/disable ai

{

return false;

}

 

public int func_82193_c(Entity par1Entity) // the ammount of damage

{

return 10;

}

 

protected void fall(float par1) {

}

 

public int getMaxHealth() // mob's health

{

return 100;

}

 

protected String getLivingSound() {

return null;

}

 

protected String getHurtSound() {

return null;

}

 

protected String getDeathSound() {

return null;

}

public boolean attackEntityAsMob(Entity par1Entity)

    {

        this.attackTimer = 10;

        this.worldObj.setEntityState(this, (byte)4);

        boolean flag = par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), 7 + this.rand.nextInt(15));

 

        if (flag)

        {

            par1Entity.motionY += 0.4000000059604645D;

        }

        this.playSound("xentree.hit", 1.0F, 1.0F);

        return flag;

    }

 

public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) {

super.writeEntityToNBT(par1NBTTagCompound);

}

 

public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {

super.readEntityFromNBT(par1NBTTagCompound);

}

 

protected float getSoundVolume() {

return 0.6F;

}

 

protected boolean canDespawn() // respawn after kill on the same spot

{

return false;

 

}

@SideOnly(Side.CLIENT)

public int getAttackTimer()

    {

        return this.attackTimer;

    }

 

 

}

 

 

Posted

If you want something to stay in one place only why would you use an Entity?

 

Also: don't bump continuously.

I want it to stand on one place. But it has to have an animations. Isnt it's suppose to be entity? Its can be a block, but with animations? Im newb at it, could you help me?

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.