Forgero - [Fabric]

Forgero - [Fabric]

85k Downloads

Rewrite the property system

SigmundGranaas opened this issue ยท 0 comments

commented

New property system

The new system is designed to fix major flaws with the old property system:

  1. Verbose
    The old system has some preconfigured notation to make it easier to apply properties, but when trying to find other attributes, you have to stream and filter properties

  2. Performance
    The old system did not have a built in way of caching values and stats, which led to a lot of operations being done when converting the state, and calculating the values from scratch.

  3. Data format
    The old system split the data format into unnecessary categories, and made it really hard to add properties of different types

  4. Fixed property types
    The old system was not extensible, and relied on enums to create all kinds of different properties.

Two new categories: Attributes and Properties

The new system can be split into two different types of values, numeric and other properties.

Attributes

Attributes are properties that can be applied as a numeric value.

Attribute classes should be responsible for grouping and applying their own attributes.

Ideally I could call AttackDamage.of(container).asInt() and it will calculate for me. This should also easily cache the values, to create a quick response.

Properties

General properties can be everything from states to handlers.

It is probably also a good idea to use multimaps instead of a filtered list for properties, but this should not be present in the api.