
[1.18] Feature request- "Soul Bound" enchantment blacklist
kwpugh opened this issue ยท 8 comments
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
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
Then using api is best way, as there is too many mods adding this enchantment already to support every single one of them
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
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?