Immovable/Unpushable Entity? [Solved somewhat]

Started by TheReallyFatChicken on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jan 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Immovable/Unpushable Entity? [Solved somewhat]
Thu, 07/16/2020 - 17:42 (edited)

So, I was wondering if there's a way to create a block-locked entity that cannot be pushed around. I can easily make it so it doesn't move on its own, but the player can still shove it, which is bad (It's pretty much a demon plant/flower that's supposed to be "rooted down").

Edit: You can have an On Entity Tick Update with Run Command data merge entity @s {NoAI:1}, which makes it immovable but also unable to move at all.

Edited by TheReallyFatChicken on Thu, 07/16/2020 - 17:42
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If you know how to code,…
Tue, 06/09/2020 - 22:43

If you know how to code, override;

EntityLiving::canBePushed

and set it false.

Joined Jan 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I could easily find that,…
Wed, 06/17/2020 - 19:46

I could easily find that, but do I just do EntityLiving::canBePushed:false or something like that? I'm not the best at coding.

 

Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
There are two methods that…
Wed, 06/17/2020 - 19:57

There are two methods that you can use to achieve this;

    @Override
    public boolean canBePushed() {
        return false;
    }

    @Override
    public boolean canBeCollidedWith() {
        return false;
    }

The method LivingEntity::canBePushed returns true if you want the entity to push and be pushed by other entities.

 

The method LivingEntity::canBeCollidedWith returns true if you want the entity to not be able to go through the entity.

 

You can use both, it is up to you. Return false if you don't want the above descriptions to happen.

Joined Jan 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The first one doesn't seem…
Thu, 07/16/2020 - 14:22

The first one doesn't seem to be working for me.