Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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;

   

        }

        {

       

        }

    }

}

 

 

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;
}

  • 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 :P

 

 

 

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;

               

        }

    }

}

 

 

Yeah what coolAlias said.

I "remember" about that method but didn't know if it still existed :P

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.

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.