use of com.minecolonies.api.crafting.ItemStorage in project minecolonies by Minecolonies.
the class CompatabilityManager method readFromNBT.
@Override
public void readFromNBT(@NotNull final NBTTagCompound compound) {
leavesToSaplingMap.putAll(NBTUtils.streamCompound(compound.getTagList(TAG_SAP_LEAVE, Constants.NBT.TAG_COMPOUND)).map(CompatabilityManager::readLeaveSaplingEntryFromNBT).collect(Collectors.toMap(Tuple::getFirst, Tuple::getSecond)));
final List<ItemStorage> storages = NBTUtils.streamCompound(compound.getTagList(TAG_SAPLINGS, Constants.NBT.TAG_COMPOUND)).map(tempCompound -> new ItemStorage(new ItemStack(tempCompound))).collect(Collectors.toList());
// Filter duplicated values.
for (final ItemStorage storage : storages) {
if (!saplings.contains(storage)) {
saplings.add(storage);
}
}
final List<IBlockState> states = NBTUtils.streamCompound(compound.getTagList(TAG_ORES, Constants.NBT.TAG_COMPOUND)).map(NBTUtil::readBlockState).collect(Collectors.toList());
for (final IBlockState state : states) {
if (!ores.contains(state.getBlock())) {
ores.add(state.getBlock());
}
}
}
Aggregations