How do I make a mob "pick up" a player?

Started by ChasingFlavors on

Topic category: Help with Minecraft modding (Java Edition)

Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I make a mob "pick up" a player?

So, is there a way to have it so when a mob attacks you, it picks you up in a way and then drops you after a set amount of ticks?

Some examples of what I'm trying to get at here is the Roc from Lycanite's Mobs, the Sludge Menace from The Betweenlands, and the Shambler from The Betweenlands.

Joined Feb 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
it occurs to me that if it…
Sun, 05/02/2021 - 18:54

it occurs to me that if it is close to the entity, the entity would raise it, up to a certain point
and then they would share speeds
if the entity goes down blocks, the player should also
if the entity is still, the player should be a little higher off the ground.
 

Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
but u can share a screen…
Thu, 11/25/2021 - 01:50

but u can share a screen shot of this procedure, i rlly want do it, (and how to make a provocation to a mob like: if u running the mob will be agressive to you)

Joined Dec 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i had it work a few times on…
Thu, 11/25/2021 - 03:03

i had it work a few times on my mobs doing it to each other but not a player  using  this code

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);
            }
        }
    }
} it works every now and again but not always

 

Joined Dec 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
it better to limit what it…
Thu, 11/25/2021 - 03:05

it better to limit what it can pic up or u just get a smash bros luigi latter in any direction 

 

Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
this procedure is only is'nt…
Wed, 02/02/2022 - 13:09

this procedure is only is'nt possible in mcreator? like with the procedure's blocks?