#Issue with bounding box in 1.20.1

52 messages · Page 1 of 1 (latest)

royal eagle
#

I'm making a custom ender dragon to replace the vanilla one.
Everything works for now BUT the bounding box. For some reason you can only hit it at the lowest point of the center and not the whole bounding box. This is a problem I have only with this entity and not my other ones even tho i followed the same method to make the bounding box.

this is what i wrote in my ModEntities class:

public static final EntityType<EndDragonEntity> END_DRAGON = Registry.register(Registries.ENTITY_TYPE,
new Identifier(EndPlusPlus.MOD_ID, "end_dragon"),
FabricEntityTypeBuilder.create(SpawnGroup.MONSTER, EndDragonEntity::new)
.dimensions(EntityDimensions.fixed(3f, 2f)).build());

sharp citrus
#

the ender dragon's hitbox in vanilla is not implemented correctly

#

all sub-hitboxes are offset by 1

#

they're also inverted

#

so when implementing your own, just make it from scratch. Don't copy the enderdragons

#

its a mess

royal eagle
#

i didn't copy the vanilla one

#

i made the bounding box how you would normally do it for an entity

#

but for some reason this one decides not to work

sharp citrus
#

does your end dragon entity extend the ender dragon?

royal eagle
#

it extends HostileEntity

sharp citrus
#

hm alright

#

use a debugger and step through the games hit logic when you attempt to punch the dragon

#

you can start from the server player interaction manager if you don't know where to start

royal eagle
#

sorry if i sound stupid, but i honestly dont get what you mean

sharp citrus
#

do you know what a debugger is

royal eagle
#

iirc it's smth that stops at a certain line of code

sharp citrus
#

oh boy

#

that's a breakpoint

#

debuggers can use breakpoints

#

read this article

royal eagle
#

ok

#

got it now

#

so where would I place the breakpoint?

sharp citrus
#

well

#

first do you know how to navigate mc's source?

royal eagle
#

like seeing minecraft's classes?

sharp citrus
#

yes, searching them and jumping to definitions

royal eagle
#

yes

sharp citrus
#

alright so in your custom mob do you have logic for when its hit?

#

if not, check the parent class if that has logic for when its hit

#

and keep going until you find the method that is invoked when the mob is hit

#

then find where it's called, all the way until you get to where the player triggers the hitting

#

put a breakpoint there

royal eagle
# sharp citrus alright so in your custom mob do you have logic for when its hit?

it's this one right?

@Override public boolean damage(DamageSource source, float amount) {

    // Ensure only server-side processes damage logic

    if (this.getWorld().isClient) return false;
    if (this.isDead()) return false;

    // If the source is one we consider invulnerable, ignore it
    if (this.isInvulnerableTo(source)) return false;

    boolean applied = super.damage(source, amount);
    return applied;
}
sharp citrus
#

try it and see

royal eagle
#

nothing happens

royal eagle
sharp citrus
#

put a breakpoint on the method definition itself

#

that will show you everytime its called

#

we are debugging why its not working

#

if that method is never called, ctrl+click on the definition to find what does call it and go up the call chain until you find where the player damages the entity

royal eagle
#

ok now it stopped

#

now what?

#

gives me this

sharp citrus
#

well

#

step through

#

node sides as well

#

!!sides

sharp citrus
#

you are debugging