Skip to content

Capybara injection example

This is an example of how a full entity injection of a Capybara entity may look like:

MyPluginBootstrapper.kt
override fun bootstrap(context: BootstrapContext) {
Bestium.getInjector().register {
EntityInjection.builder(
Key.key("my_plugin", "capybara"),
Capybara::class.java,
::Capybara,
::CraftAnimals,
EntityType.PIG
)
.setDisplayName(Component.text("Capybara"))
.setDefaultAttributes(Capybara.createDefaultAttributes())
.setMobCategory(MobCategory.CREATURE)
.addVariants(
EntityVariant.fromModelResource(
"normal",
this,
"models/capybara/normal.bbmodel"
),
EntityVariant.fromModelResource(
"blue",
this,
"models/capybara/blue.bbmodel"
)
)
.setVariantRule(
VariantRule.firstMatch(
VariantRule.ifBiome(
BiomeFilter.tag(Key.key("minecraft:spawns_cold_variant_farm_animals")),
"blue"
),
VariantRule.always("normal")
)
)
.setSpawnRule(
SpawnRule.ifBiome(
BiomeFilter.tag(Key.key("minecraft:is_river")),
SpawnData(3, 1, 4)
)
)
.setTypeCustomizer { builder ->
// Capybaras are, of course, naturally fire immune
builder.fireImmune()
}
.build()
}
}