Making a mob grab you and other mobs specified

Started by kaposuchus on

Topic category: Troubleshooting, bugs, and solutions

Joined Dec 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Making a mob grab you and other mobs specified

 

this worked in the last version  i had an eagle grab a fish from the surface or lower. it did make mob zoom forward but not by much  cause i think it use the panic speed of the fish 

 

Joined Dec 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
 i cant post the pic package…
Wed, 11/24/2021 - 03:47

 i cant post the pic

package eons.procedures;

import net.minecraft.util.DamageSource;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.passive.fish.CodEntity;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.Entity;

import java.util.Map;
import java.util.Collections;

import eons.EonsMod;

public class EonsAnomalocarisGrabProcedure {

    public static void executeProcedure(Map<String, Object> dependencies) {
        if (dependencies.get("entity") == null) {
            if (!dependencies.containsKey("entity"))
                EonsMod.LOGGER.warn("Failed to load dependency entity for procedure EonsAnomalocarisGrab!");
            return;
        }
        Entity entity = (Entity) dependencies.get("entity");
        if (entity instanceof CodEntity) {
            if (((entity instanceof MobEntity) ? ((MobEntity) entity).getAttackTarget() : null).getPosX() == entity.getPosX()
                    && ((entity instanceof MobEntity) ? ((MobEntity) entity).getAttackTarget() : null).getPosZ() == entity.getPosZ()
                    && ((entity instanceof MobEntity) ? ((MobEntity) entity).getAttackTarget() : null).getPosY() >= entity.getPosY()) {
                {
                    Entity _ent = ((entity instanceof MobEntity) ? ((MobEntity) entity).getAttackTarget() : null);
                    _ent.setPositionAndUpdate((entity.getPosX()), (entity.getPosY()), (entity.getPosZ()));
                    if (_ent instanceof ServerPlayerEntity) {
                        ((ServerPlayerEntity) _ent).connection.setPlayerLocation((entity.getPosX()), (entity.getPosY()), (entity.getPosZ()),
                                _ent.rotationYaw, _ent.rotationPitch, Collections.emptySet());
                    }
                }
                ((entity instanceof MobEntity) ? ((MobEntity) entity).getAttackTarget() : null).attackEntityFrom(DamageSource.GENERIC, (float) 1);
            }
        }
    }
}
 

Joined Dec 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
its also on an eagle     
Wed, 11/24/2021 - 03:49

its also on an eagle