use of org.spongepowered.common.block.SpongeBlockSnapshotBuilder in project SpongeForge by SpongePowered.
the class MixinBlockSnapshot method createSpongeBlockSnapshot.
@Override
public BlockSnapshot createSpongeBlockSnapshot() {
Location<World> location = new Location<>((World) this.getWorld(), VecHelper.toVector3i(this.pos));
SpongeBlockSnapshotBuilder builder = new SpongeBlockSnapshotBuilder();
builder.blockState((BlockState) this.replacedBlock).worldId(location.getExtent().getUniqueId()).position(location.getBlockPosition());
if (this.nbt != null) {
builder.unsafeNbt(this.nbt);
}
TileEntity te = getTileEntity();
if (te != null) {
if (!te.hasWorld()) {
te.setWorld(this.getWorld());
}
for (DataManipulator<?, ?> manipulator : ((IMixinCustomDataHolder) te).getCustomManipulators()) {
builder.add(manipulator);
}
}
return builder.build();
}
Aggregations