Universal Graves

Universal Graves

5M Downloads

[1.18] Feature request- "Soul Bound" enchantment blacklist

kwpugh opened this issue ยท 8 comments

commented

Question: is there a way to add the name of "soul bound" enchantments from other mods that will not be placed in a grave?

If no, would you consider adding an option for a "soul bound" enchantment blacklist?

I added a "soul bound" enchantment to my 1.18 mod, so I can't test your mod with it at present.

My enchantment works primarily by mixin into PlayerEntity#dropItem(). If the item is properly enchanted, the item is given back. The reason I used dropItem() is because I want the enchanted item to be returned if the player press "Q" accidentally dropping the item. Then I use the fabric ServerPlayerEvent#copyFrom to copy the inventory from the old player to the new player.
https://github.com/kwpugh/MoreGems/blob/1.18-rc2/src/main/java/com/kwpugh/more_gems/mixin/PlayerEntityMixin.java

It looks like your mod captures at LivingEntity#drop(). Maybe you could put a check in there to test for blacklisted enchantments on the item and skip it if confirmed.

Either way, thanks for reading and considering.

Regards,

kwpugh

commented

Thank you, I think a config option would be a much simpler option.

commented

Hi! If your enchanment's path contains soulbound or soul_bound you don't need to do anything. If it's not the case, you can listen to the GravesApi.ADD_ITEM_EVENT and return ActionResult.FAIL for items with it

commented

there is another mod in 1.18 that adds an enchantment called "keeping".

commented

my enchantment is called "bound"

Screen Shot 2021-11-26 at 10 13 22 AM

commented

Then using api is best way, as there is too many mods adding this enchantment already to support every single one of them

commented

This new grave mod for Fabric has a simple config list option to blacklist any named enchantment.

https://www.curseforge.com/minecraft/mc-mods/youre-in-grave-danger

commented

Hence an config or JSON option to allow players/pack makers to add enchantment names, would be externally data-driven rather hard coded to an api. Just a thought.

By the way, I'm still learning Java, how do you "listen" for the api? Would I have to add a dependency to my mod?

commented

I can add that, but any mod still should do it with an api. And yes, you need to add this mod as dependency, but it can be optional while only activinting with mod present (which is better option as you can customise it way more)