diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/data/loot/CopyTileNbtFunction.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/data/loot/CopyTileNbtFunction.kt index d607e1ec4..4858c7cf3 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/data/loot/CopyTileNbtFunction.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/data/loot/CopyTileNbtFunction.kt @@ -14,6 +14,7 @@ import net.minecraft.world.level.storage.loot.Serializer import net.minecraft.world.level.storage.loot.functions.LootItemFunction import net.minecraft.world.level.storage.loot.functions.LootItemFunctionType import net.minecraft.world.level.storage.loot.parameters.LootContextParams +import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity import ru.dbotthepony.mc.otm.core.nbt.set import ru.dbotthepony.mc.otm.core.set import ru.dbotthepony.mc.otm.core.stream @@ -34,7 +35,14 @@ class CopyTileNbtFunction(filter: Stream = Stream.empty()) : LootIte val blockEntity = u.getParamOrNull(LootContextParams.BLOCK_ENTITY) ?: return t val result = t.tagNotNull[BlockItem.BLOCK_ENTITY_TAG] as? CompoundTag - val data = blockEntity.saveWithoutMetadata() + val data: CompoundTag + + if (blockEntity is MatteryBlockEntity) { + data = CompoundTag() + blockEntity.saveShared(data) + } else { + data = blockEntity.saveWithoutMetadata() + } for (k in filter) { data.remove(k)