-
Notifications
You must be signed in to change notification settings - Fork 7
Extending Existing Minecraft Entities
All custom mobs share a common CustomMob
class. However, since protected values and methods commonly need to be accessed or overriden, each mob must manually reimplement each method correctly.
Because this boilerplate code is undesirable, mobzy provides an annotation processor which will copy code from a base entity class (MobBase
), which implements CustomMob
and extends NMSEntityInsentient
.
Simply annotate your new type with @GenerateFromBaseClass
and extend the generated class. For example if you wished to extend NMSEntityPig
, you would do:
@GenerateFromBase(base = MobBase::class, createFor = [EntityPig::class])
class CustomEntityPig(type: NMSEntityType<*>, world: NMSWorld) : MobzyEntityPig(world, type)
You may also customize the name of the generated class, by default it will simply prefix it with Mobzy
.
If any of this code is broken in future versions, just check how it's done within a class like PassiveMob
.
In the future there will be a way of registering this new class for use by mob configs, by specifying the baseClass
property.
For now, three classes exist, registered as: mobzy:passive
, mobzy:hostile
, mobzy:flying
.