#Red Lien in hitbox

34 messages · Page 1 of 1 (latest)

glass tusk
#

Hi. Can you tell me if it's possible to change the height of the red line in the hitbox? I'm using Fabric 1.21 IntelliJ.

peak shard
#

it’s based on the entities eye height iirc

#

so ig change that

#

actually maybe don’t cuz that would affect how suffocation and stuff works, what do you want to do this for?

glass tusk
#

When my entity enters the water, it changes its hitbox and model position, but the red line is outside the hitbox (2-3 blocks higher). Therefore, I want to lower the red line to the hitbox with the model.

mental palm
peak shard
glass tusk
#

If anything, here is my problem on the screenshot itself.

mental palm
glass tusk
#

Unfortunately, if I use the method (public Entity Dimensions getDimensions(Entity Pose pose) then I get the error 'getDimensions(EntityPose)' cannot override 'getDimensions(EntityPose)' in 'net.minecraft.entity.LivingEntity'; overridden method is final

mental palm
#

the dimensions come from your EntityType

#

you wouldnt override getDimensions

mental palm
glass tusk
#

If you mean my Example Mixin, it looks like this package net.jarviz.alienmod.mixin;

import net.minecraft.server.MinecraftServer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(MinecraftServer.class)
public class ExampleMixin {
@Inject(at = @At("HEAD"), method = "loadWorld")
private void init(CallbackInfo info) {

}

} and in my entity class the entity belongs HostileEntity public class PreatorianEntity extends HostileEntity implements GeoEntity {

mental palm
#

what does your custom entity type look like

#

as thats where you define the dimensions/eyeHeight

glass tusk
#

Do you want to see the entire entity code?
I just don't fully understand.

#

I have ModEntities where the size of the entity is specified public class ModEntities {

public static final EntityType<PreatorianEntity> PREATORIAN = FabricEntityTypeBuilder.create(
                SpawnGroup.MONSTER,
                PreatorianEntity::new
        )
        .dimensions(EntityDimensions.fixed(1.2f, 3.8f))
        .trackable(64, 3)
        .build();                                                                                    

There's also a PreatorianEntity where goals, attack speed, HP, etc. are listed. But it's quite huge.

mental palm
#

after you call fixed

#

do .withEyeHeight

#

and set your eyeHeight

#
public static final EntityType<PreatorianEntity> PREATORIAN = FabricEntityTypeBuilder.create(
      SpawnGroup.MONSTER,
      PreatorianEntity::new
).dimensions(EntityDimensions.fixed(1.2f, 3.8f).withEyeHeight(0.2F))
            .trackable(64, 3)
            .build();```
#

for example

#

figure out where you want the eyeHeight to be

#

and change the 0.2F to it

glass tusk
#

Thank you very much for your help :). I will try your method and write back whether it worked or not.

glass tusk
#

Unfortunately, the line of sight doesn't change when the hitbox changes. Alternatively, I can raise the hitbox and model by a certain amount for swim mode, then the hitbox model and line of sight will be one.

mental palm
glass tusk
mortal notch
#

PlayerEntity does this

#

It changes the dimensions of the player (including eyeHeight) based on the entitypose