Procedure attack

Started by Kapitan Polska on Fri, 04/23/2021 - 17:53

Topic category: Advanced modding

Last seen on 13:09, 5. May 2021
Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Procedure attack
Fri, 04/23/2021 - 17:53

How to do a procedure for the fact that a given mob dies immediately from a given item, and if it is not this item, it does not die and you have to fight it normally? If someone knows, I would ask for a photo

Last seen on 15:35, 27. Apr 2021
Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Hi everyone! For the first…
Tue, 04/27/2021 - 15:37

Hi everyone! For the first time in a long time, I feel I can confide in someone who understands yet proposes positive motivating advices and the newest approaches. I'm blessed I've found online therapy and search forward to each session as a new brilliant journey. It also implements tasks that are conducive to helping with the issues presented. I strongly recommend it online talk therapy to use for everyone!

Last seen on 17:14, 13. Jun 2021
Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Nice, but is it really…
Fri, 05/14/2021 - 23:14

Nice, but is it really related? Come on.

Last seen on 18:01, 6. Jun 2021
Joined Jun 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Hi, I don’t know if there is…
Sat, 06/05/2021 - 00:49

Hi, I don’t know if there is an existing procedure for the action you described, but you can try to write it yourself. Here are some tips:
 about instant kill - in 1.12 the / kill command works like this:
 

this.attackEntityFrom (DamageSource.OUT_OF_WORLD, Float.MAX_VALUE)

Simple and effective.
Or when hitting with a specific item, you can try the entity.setDead method.

Last seen on 18:01, 6. Jun 2021
Joined Jun 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I can also share my piece of…
Sat, 06/05/2021 - 00:59

I can also share my piece of code, but it does slightly different things, allows you to kill a mob with one hit with any object and does not take away damage to the object.
 

@Override
    public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase player) {
        if (player.worldObj.isRemote) {
            return false;
        }
        if (target.canAttackWithItem() && !target.hitByEntity(player) && !target.equals(player)) {
            target.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) player), target.getHealth());
            stack.damageItem(1, player);
            return true;
        }
        return false;
    }

soclikes.com