KubeJS-Mods / KubeJS

https://kubejs.com
GNU Lesser General Public License v3.0
314 stars 91 forks source link

Attribute #885

Closed pietro-lopes closed 3 months ago

pietro-lopes commented 3 months ago

Attribute Builder

Example

StartupEvents.registry('attribute', e => {
  e.create('test_attribute_bool_monsters')
    .bool(false)
    .syncable(false) // default is true
    .sentiment("NEGATIVE") // default is POSITIVE
    .attachToMonsters() // default is to add to all entity types

  e.create('test_attribute_range_players')
    .range(10, 0, 50)
    .sentiment("NEUTRAL")
    .attachToPlayers()

  e.create('test_attribute_range_ambient')
    .range(25, -50, 50)
    .syncable(false)
    .attachToCategory("AMBIENT")

  e.create('test_attribute_all_default')
    .range(15, 10, 25)

  e.create('test_attribute_predicate_fire_immune')
    .range(-5, -20, 30)
    .attachTo(entityType => entityType.fireImmune())
})

Other details