EntityJS

EntityJS

496k Downloads

Entity classes are shadowing the navigation field

NightrainsRbx opened this issue ยท 3 comments

commented

All custom entity classes define a navigation field, shadowing the navigation field of the Mob class, so when it creates the PathNavigation it sets it to that new field instead, since it doesn't override the getNavigation method it calls the one in the Mob class which returns the navigation field of the Mob class.

This makes adding custom PathNavigation not work at all since they are set to the wrong field and never used.

It is necessary in order to make Flying, Aquatic, and Wall Climber entities.

As a feature request, adding a way to change the MoveControl in the entity builder is also necessary, flying entities are required to use FlyingMoveControl.

commented

i see, ill do that as well as add lookControl and jumpControl while im at it

commented

This should now be fixed in the latest EntityJS release (0.3.6-1.20.1/1.19.2) or (1.1.0-1.21). I also added methods for creating builders for LookControlJS . MoveControlJS & JumpControlJS to the EntityJSUtils binding which should allow full customization of these base classes if you decide on going that route.

StartupEvents.registry("entity_type", event => {
	event.create("wyrm", "minecraft:axolotl")
		.createNavigation(ctx => {
			return EntityJSUtils.createGroundPathNavigation(ctx.entity, ctx.level)
		})
		.setLookControl(entity => {
			return EntityJSUtils.createLookControl(entity, builder => { })
		})
		.setMoveControl(entity => {
			return EntityJSUtils.createMoveControl(entity, builder => { })
		})
		.setJumpControl(entity => {
			return EntityJSUtils.createJumpControl(entity, builder => { })
		})
})
commented

Yep, that works perfectly, thx!