Project Expansion

Project Expansion

4M Downloads

Transmutation Interface does not save items with NBT

awes12 opened this issue ยท 1 comments

commented

If an item has NBT data that is not the default NBT data, it will not be saved using the Transmutation Interface. This is most likely so the NBT isn't lost through saving (because the actual item would be deleted otherwise). However, it would be nice to still save the item as knowledge, but just not remove it from the storage system.

To solve this, just change:

if(getFilterStatus() && !NBTManager.getPersistentInfo(info).equals(info)) return stack;

To something like:

if(getFilterStatus() && !NBTManager.getPersistentInfo(info).equals(info)) {
    @Nullable IKnowledgeProvider provider = Util.getKnowledgeProvider(owner);
     if(provider == null) return stack;
     ServerPlayer player = Util.getPlayer(level, owner);
     if (player != null) {
         if (provider.addKnowledge(stack)) provider.syncKnowledgeChange(player, NBTManager.getPersistentInfo(info), true);
         provider.syncEmc(player); //Not 100% sure whether this only changes EMC count, so kept it. Prob don't need
     }
     return stack;
} 
commented

This is already a thing

getFilterStatus()

Their nbt filter is on by default

Read the wiki page