use of org.lanternpowered.server.block.tile.LanternTileEntityType in project LanternServer by LanternPowered.
the class TileEntitySerializer method deserialize.
@Override
public LanternTileEntity deserialize(DataView dataView) throws InvalidDataException {
final String id = fixTileId(dataView, dataView.getString(ID).get());
dataView.remove(ID);
final LanternTileEntityType tileEntityType = (LanternTileEntityType) Sponge.getRegistry().getType(TileEntityType.class, id).orElseThrow(() -> new InvalidDataException("Unknown tile entity id: " + id));
// noinspection unchecked
final ObjectStore<LanternTileEntity> store = (ObjectStore) ObjectStoreRegistry.get().get(tileEntityType.getTileEntityType()).get();
// noinspection unchecked
final LanternTileEntity entity = (LanternTileEntity) tileEntityType.getTileEntityConstructor().get();
store.deserialize(entity, dataView);
return entity;
}
Aggregations