T3ctonic Posted June 4, 2014 Share Posted June 4, 2014 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; } { } } } Quote Link to comment Share on other sites More sharing options...
TLHPoE Posted June 4, 2014 Share Posted June 4, 2014 You could set the fall height field to 0 in the onUpdate method. Quote Kain Link to comment Share on other sites More sharing options...
coolboy4531 Posted June 5, 2014 Share Posted June 5, 2014 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; } Quote Link to comment Share on other sites More sharing options...
blaxout1213 Posted June 5, 2014 Share Posted June 5, 2014 Add and "@Override" the "attackEntityFrom" method to check for fall damage and then dont apply it. Quote Link to comment Share on other sites More sharing options...
T3ctonic Posted June 5, 2014 Author Share Posted June 5, 2014 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; } } } Quote Link to comment Share on other sites More sharing options...
coolboy4531 Posted June 5, 2014 Share Posted June 5, 2014 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/ Quote Link to comment Share on other sites More sharing options...
coolAlias Posted June 5, 2014 Share Posted June 5, 2014 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. Quote http://i.imgur.com/NdrFdld.png[/img] Link to comment Share on other sites More sharing options...
coolboy4531 Posted June 5, 2014 Share Posted June 5, 2014 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.