Apotheosis

Apotheosis

90M Downloads

[Suggestion] Add a templet Affix implementation class.

rtxyd opened this issue ยท 4 comments

commented

public abstract class Affix implements CodecProvider<Affix>, Weighted {

This is now an abstract class, in apotheosis, there's no datapack driven custom affix "type" yet, And other implementations of this class often come with side effect, not safe to create really empty affix definition for NBT check.
If there's an implementation of this abstract class which literally implements nothing, people can safely create many empty Affix instances and with correct datapack to make them be rolled by the game, if it's KubeJS, that is able to bound with events and trigger real unique effects through NBT check.
public abstract boolean canApplyTo(ItemStack stack, LootCategory cat, LootRarity rarity);

This is the only abstract method in Affix class. A bit further prospect is adding a vanilla command codec to cover more usecases. If it can be combined with vanilla criterion, that could be more useful.
In my mind, an empty affix json could be:

{
    "type": "apotheosis:templet_affix",
    "definition": {
        "affix_type": "basic_effect",
        "weights": {
            "weight": 25,
            "quality": 0.1
        },
        "exclusive_set": []
    },
    "can_apply_to": {
        "itemstack": [
            "item1",
            "item2"
        ],
        "lootcategory": [
            "cat1",
            "cat2"
        ],
        "lootrarity": [
            "rarity1",
            "rarity2"
        ]
    }
}

If it's with a futher implementation, like vanilla command trigger

{
    "type": "apotheosis:templet_affix",
    "definition": {
        "affix_type": "basic_effect",
        "weights": {
            "weight": 25,
            "quality": 0.1
        },
        "exclusive_set": []
    },
    "can_apply_to": {...},
    "criteria": {...},
    "command": "/kill @s"
}

If there could be a functional customized affix, this is a forward leap for Apotheosis datapack driven contents.

commented

That seems the modular things like above will not be officially implemented. I see.
That answer is my purpose in this issue, so for the moment it may be completed or not-planned.

commented

This is really the barrier of "things you should write a mod for", rather than try to hack in with KJS.

commented

The thing about NBT check is just one side of this suggestion, if it's not planned, I'll try to make it work in another way. As for java modding, I may try it when everything settled irl.
On the other side, could affix instance be more modular in future? For a simple example, applied to preset items with specified rarities like above, and combine with lootcategory, rather than only by lootcategory.
I am not expecting for futher things, the idea I'm providing may be not good, the customized functional affix here is just one of its potential.

commented

Affixes are as modular as the given extension of Affix implements. None of the affixes implement per-item filtering because it doesn't make any sense in the design space, but that isn't stopping anyone from making a custom Affix implementation with those constraints.