#Red Lien in hitbox
34 messages · Page 1 of 1 (latest)
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?
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.
hook into the HitboxRenderering code or wherver (diff if in 1.21.10+/etc) and change the state.eyeHeight field
ah i thought you just wanted to remove it, in that case i’m pretty sure there’s a method you can override on your entity to change the eye height
If anything, here is my problem on the screenshot itself.
do you set the eye height of your entity dimensions
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
do you have a custom entity type?
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 {
sorry ignore mixin
what does your custom entity type look like
as thats where you define the dimensions/eyeHeight
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.
there
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
Thank you very much for your help :). I will try your method and write back whether it worked or not.
:)
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.
Is it using your entity type? Do you have any other hitbox code
I have codes in PreatorianEntity