Jump to content

[1.7.10] How To Make A Custom Flying Mob?


MikeDark

Recommended Posts

I would like to make a monster that attacks you physically flying, but the eclipse don't open the references classes, and researching on the internet just find codes from older versions and end up not working, and extending to EntityFlying can not set the caused damage...

 

My Ghost Class:

 


package mike.bathicraft.mob;

import mike.bathicraft.items.GerenciadorDeItems;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIFleeSun;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.ai.EntityAIRestrictSun;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.monster.EntityMob;
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.util.ChunkCoordinates;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;

public class EntityFantasma extends EntityMob {

	public EntityFantasma(World world) {
		super(world);
		this.setSize(0.9F, 1.9F);
		this.experienceValue = 5;
		this.tasks.addTask(0, new EntityAISwimming(this));
        this.tasks.addTask(3, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, true));	        
        this.tasks.addTask(7, new EntityAIWander(this, 1.0D));
        this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 12.0F));
        this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
        this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));
	}

	  @Override
	    protected void applyEntityAttributes()
	    {
	        
	        super.applyEntityAttributes();
	        this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D);
	        this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(20.0D);
	        this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.4D);
	        this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(15.0D);
	        
	    }
	  
		protected boolean isAIEnabled()
	    {
	        return true;
	    }
		 		 		  
		 protected Item getDropItem(){
				return Items.iron_ingot;
			}

			protected void dropRareDrop(int par1){
				switch (this.rand.nextInt(3)){

				case 0:
					this.dropItem(Items.iron_sword, 1);
				}
			}

			 public boolean doesEntityNotTriggerPressurePlate()
			    {
			        return true;
			    }

			 protected void updateFallState(double par1, boolean par3) {}

			 protected void fall(float par1) {}

			 protected boolean canTriggerWalking()
			    {
			        return false;
			    }


}


Link to comment
Share on other sites

There are plenty of examples in vanilla code, like EntityBlaze and EntityGhast.

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.



×
×
  • Create New...

Important Information

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