Transfer enchantments from recipe ingredients to result item in EnergyContainerRecipe
Fixes #216
This commit is contained in:
parent
aa32dea682
commit
56789d0e40
@ -13,6 +13,7 @@ import net.minecraft.world.item.crafting.ShapedRecipe
|
||||
import net.minecraft.world.level.Level
|
||||
import ru.dbotthepony.mc.otm.capability.ItemEnergyStorageImpl
|
||||
import ru.dbotthepony.mc.otm.capability.matteryEnergy
|
||||
import ru.dbotthepony.mc.otm.container.iterator
|
||||
import ru.dbotthepony.mc.otm.container.stream
|
||||
import ru.dbotthepony.mc.otm.core.set
|
||||
import ru.dbotthepony.mc.otm.core.tagNotNull
|
||||
@ -40,6 +41,16 @@ class EnergyContainerRecipe(
|
||||
itemStack.tagNotNull[ItemEnergyStorageImpl.ENERGY_KEY] = battery.batteryLevel.serializeNBT()
|
||||
}
|
||||
|
||||
if (itemStack.isEnchantable) {
|
||||
for (it in container.iterator()) {
|
||||
if (!it.isEmpty && it.isDamageableItem && it.isEnchanted) {
|
||||
for ((key, value) in it.allEnchantments) {
|
||||
itemStack.enchant(key, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return itemStack
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user