Posted June 4, 201411 yr Well the title basically says it all Entity Class package Eclipse7.MysticEnergies.mobs.entity; import net.minecraft.entity.Entity; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.monster.EntityMob; import net.minecraft.item.Item; import net.minecraft.world.World; import Eclipse7.MysticEnergies.common.MysticEnergies; public class EntityDarkEnergyGolem extends EntityMob{ public EntityDarkEnergyGolem(World par1World) { super(par1World); this.setHealth(this.getHealth()); this.isImmuneToFire = true; } protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(250.0D); this.getEntityAttribute(SharedMonsterAttributes.followRange).setAttribute(100.0D); this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setAttribute(5.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.2D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(5.0D); } public int getAttackStength(Entity par1Entity) { return 5; } public boolean getCanSpawnHere() { return this.worldObj.difficultySetting > 0 && this.isValidLightLevel() && super.getCanSpawnHere(); } protected String getLivingSound() { return "none"; } protected String getHurtSound() { return "mob.irongolem.hit"; } protected String getDeathSound() { return "mob.irongolem.death"; } protected void dropRareDrop(int par1) { switch (this.rand.nextInt(3)) { case 0: this.dropItem(MysticEnergies.DarkEnergy.itemID, 1); break; } { } } }
June 5, 201411 yr Use LivingFallEvent. Check if the event that gets hurt is "your entity" or "the entity you want" that takes fall damage. Change the "distance" to 0. Example: @SubscribeEvent public void livingFall(LivingFallEvent event) { if (event.entityLiving instanceof EntityPlayer) EntityPlayer player = (EntityPlayer) event.entityLiving; event.distance = 0F; }
June 5, 201411 yr Add and "@Override" the "attackEntityFrom" method to check for fall damage and then dont apply it.
June 5, 201411 yr Author Well I assume what I have done is wrong if you could try and correct me using my code it would be appreciated or just point out where I went wrong thanks P.S its 2 AM for me package Eclipse7.MysticEnergies.mobs.entity; import net.minecraft.entity.Entity; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.world.World; import net.minecraftforge.event.entity.living.LivingFallEvent; import Eclipse7.MysticEnergies.common.MysticEnergies; public class EntityDarkEnergyGolem extends EntityMob{ public EntityDarkEnergyGolem(World par1World) { super(par1World); this.setHealth(this.getHealth()); this.isImmuneToFire = true; @SubscribeEvent public void livingFall(LivingFallEvent event) { if (event.entityLiving instanceof EntityDarkEnergyGolem) EntityMob entityToAttack = (EntityMob) event.entityLiving; event.distance = 0F; } } protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(250.0D); this.getEntityAttribute(SharedMonsterAttributes.followRange).setAttribute(100.0D); this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setAttribute(5.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.2D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(5.0D); } public int getAttackStength(Entity par1Entity) { return 5; } public boolean getCanSpawnHere() { return this.worldObj.difficultySetting > 0 && this.isValidLightLevel() && super.getCanSpawnHere(); } protected String getLivingSound() { return "none"; } protected String getHurtSound() { return "mob.irongolem.hit"; } protected String getDeathSound() { return "mob.irongolem.death"; } protected void dropRareDrop(int par1) { switch (this.rand.nextInt(3)) { case 0: this.dropItem(MysticEnergies.DarkEnergy.itemID, 1); break; } } }
June 5, 201411 yr You are suppose to create an event class. I realize that you are using 1.6.4. This also means you should be using @ForgeSubscribe instead of @SubscribeEvent. Here ya go! http://www.minecraftforum.net/topic/1419836-forge-4x-events-howto/
June 5, 201411 yr No guys, it's much simpler; the OP is creating a custom entity, so simply override the Entity#fall method to do nothing. @Override protected void fall(float distance) {} This is how vanilla mobs such as the chicken take no fall damage. http://i.imgur.com/NdrFdld.png[/img]
June 5, 201411 yr Yeah what coolAlias said. I "remember" about that method but didn't know if it still existed so... I just gave him a way. Ignore the other posts, and use coolAlias's.
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.