use of com.simibubi.create.foundation.utility.IPartialSafeNBT in project Create by Creators-of-Create.
the class SchematicannonTileEntity method launchBlockOrBelt.
protected void launchBlockOrBelt(BlockPos target, ItemStack icon, BlockState blockState, BlockEntity tile) {
if (AllBlocks.BELT.has(blockState)) {
blockState = stripBeltIfNotLast(blockState);
if (tile instanceof BeltTileEntity && AllBlocks.BELT.has(blockState))
launchBelt(target, blockState, ((BeltTileEntity) tile).beltLength);
else if (blockState != Blocks.AIR.defaultBlockState())
launchBlock(target, icon, blockState, null);
} else {
CompoundTag data = null;
if (tile != null) {
if (AllBlockTags.SAFE_NBT.matches(blockState)) {
data = tile.saveWithFullMetadata();
data = NBTProcessors.process(tile, data, true);
} else if (tile instanceof IPartialSafeNBT) {
data = new CompoundTag();
((IPartialSafeNBT) tile).writeSafe(data, false);
data = NBTProcessors.process(tile, data, true);
}
}
launchBlock(target, icon, blockState, data);
}
}
Aggregations