[Tutorial] how to make entity with solid hitbox and make it unpushable

Started by Slivka0109 on

Topic category: User side tutorials

Last seen on 19:56, 8. Aug 2023
Joined Mar 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[Tutorial] how to make entity with solid hitbox and make it unpushable

version:

-Mcreator 2022.2

-1.16.5

requirements:

you need to have completed entity to dont edit code after added collision.

dont unlock entity code after completion or you have to do that again

 

STEPS:

1.lock your entity

2.now open your entity java class file (not rendered and egg)

3.import those under others imports:

import net.minecraft.entity.Entity; 
import net.minecraft.entity.MoverType;
import net.minecraft.util.math.vector.Vector3d;

4.under this text:  public CustomEntity(EntityType<CustomEntity> type, World world) {

            super(type, world);

            experienceValue = 0;

            setNoAI(false);

            enablePersistence();

        }
.add:

        @Override
public boolean func_241845_aY() {
return true;
}

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

@Override
protected boolean canTriggerWalking() {
return false;
}

func_241845 is canbecollide (if you want soild hitbox true this)

canbepushed useful for mechas or vehicle or bosses

canTriggerWalking set to true if entity have ai

 

after this you can test entity 

 

Last seen on 19:56, 8. Aug 2023
Joined Mar 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
ops mistake you have to…
Thu, 08/03/2023 - 11:01

ops mistake you have to delete this :        @Override
        protected boolean canTriggerWalking() {
                return false;
        }

and add this under canbepushed:

        @Override
public void applyEntityCollision(Entity p_70108_1_) {}
Last seen on 21:00, 26. Apr 2024
Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
how would you do this…
Fri, 08/11/2023 - 01:40

how would you do this

MCreator 2023.1

minecraft version 1.19.2

Last seen on 07:42, 22. Oct 2023
Joined Aug 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
there is an easier way First…
Tue, 08/15/2023 - 07:46

there is an easier way

First go into the entity mode elemenns and make entity immune to knockback

Last seen on 21:00, 26. Apr 2024
Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
but do you know if that will…
Thu, 08/17/2023 - 00:09

but do you know if that will allow you to walk on the entity

Last seen on 21:00, 26. Apr 2024
Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
nevermind, there was an…
Thu, 08/17/2023 - 00:13

nevermind, there was an option to disable entity collision