Posted January 30, 201510 yr Alright, so the mob is killed with a normal sword after three hits when it is suppose to have 300 health. I copied the health from the wither, either way though 300.0d and 300.0D do nothing to improve its health. protected void applyEntityAttribute(){ super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(300.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.45D); this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(25.0D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(50.0D); } Heres the entire classfile if you need it package com.phantasyrealms.entity; import com.phantasyrealms.item.PhantasyRealmsItems; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAIMoveThroughVillage; import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction; 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.boss.IBossDisplayData; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.monster.IMob; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class EntityHildeBearMob extends EntityMob implements IBossDisplayData{ public EntityHildeBearMob(World par1World) { super(par1World); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 0.3D, false)); this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 0.45D)); this.tasks.addTask(7, new EntityAIWander(this, 0.4D)); this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); this.setSize(1.9F, 2.5F); } public boolean isAIEnabled(){ return true; } protected boolean canDespawn() { return false; } protected void applyEntityAttribute(){ super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(300.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.45D); this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(25.0D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(50.0D); } protected void entityInit() { super.entityInit(); } protected Item getDropItem() { return PhantasyRealmsItems.saber; } /** * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param * par2 - Level of Looting used to kill this mob. */ protected void dropFewItems(boolean par1, int par2) { int dropType = rand.nextInt(40); if(dropType == 1){ this.dropItem(PhantasyRealmsItems.rsaber, 1); } if(dropType == 3){ this.dropItem(PhantasyRealmsItems.scimitar, 1); } if(dropType == 5){ this.dropItem(PhantasyRealmsItems.rsword3, 1); } if(dropType == 7){ this.dropItem(PhantasyRealmsItems.brand2, 1); } if(dropType == 9){ this.dropItem(PhantasyRealmsItems.reHelmet, 1); } if(dropType == 11){ this.dropItem(PhantasyRealmsItems.rePlate, 1); } if(dropType == 13){ this.dropItem(PhantasyRealmsItems.rePants, 1); } if(dropType == 15){ this.dropItem(PhantasyRealmsItems.reBoots, 1); } if(dropType == 17){ this.dropItem(PhantasyRealmsItems.teHelmet, 1); } if(dropType == 19){ this.dropItem(PhantasyRealmsItems.tePlate, 1); } if(dropType == 21){ this.dropItem(PhantasyRealmsItems.tePants, 1); } if(dropType == 23){ this.dropItem(PhantasyRealmsItems.teBoots, 1); } if(dropType == 31){ this.dropItem(PhantasyRealmsItems.rsaber1, 1); } if(dropType == 37){ this.dropItem(PhantasyRealmsItems.baxe1, 1); } if(dropType == 25){ this.dropItem(PhantasyRealmsItems.meseta, 30); } if(dropType == 27){ this.dropItem(PhantasyRealmsItems.meseta, 35); } if(dropType == 29){ this.dropItem(PhantasyRealmsItems.meseta, 40); } } protected void dropRareDrop(int p_70600_1_) { this.entityDropItem(new ItemStack(PhantasyRealmsItems.digrinder, 1, 1), 0.0F); } }
January 30, 201510 yr Try using this tutorial. https://theancientminecrafter.wordpress.com/2014/05/11/entity-or-mob-tutorial/ I think your missing the data watcher in your code, the client will show that the entity has 300 health but the server would have not updated yet and still think that the entity has the default health. I require Java, both the coffee and the code
January 30, 201510 yr Try using this tutorial. https://theancientminecrafter.wordpress.com/2014/05/11/entity-or-mob-tutorial/ I think your missing the data watcher in your code, the client will show that the entity has 300 health but the server would have not updated yet and still think that the entity has the default health. There's no need to use a DataWatcher, applyEntityAttributes() is called on both sides. @OP: Add @Override to all of your methods you intend to override, it will tell you something is wrong. You missed the s at the end of your applyEntityAttributes() method. Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! | mah twitter This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.
January 30, 201510 yr Author Try using this tutorial. https://theancientminecrafter.wordpress.com/2014/05/11/entity-or-mob-tutorial/ I think your missing the data watcher in your code, the client will show that the entity has 300 health but the server would have not updated yet and still think that the entity has the default health. There's no need to use a DataWatcher, applyEntityAttributes() is called on both sides. @OP: Add @Override to all of your methods you intend to override, it will tell you something is wrong. You missed the s at the end of your applyEntityAttributes() method. Alright so for the Health, adding the s at the end of applyEntityAttributes actually worked, however, Now the mob is like OP strong, no matter what I set the damage value to it is like a 2 hit kill and the lower I set it ex 9.0D the strong it gets. while even when I set it to 90.0D it does half damage but then anything higher it does higher damage
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.