use of org.spongepowered.api.data.manipulator.mutable.tileentity.BrewingStandData in project SpongeCommon by SpongePowered.
the class SpongeBrewingStandBuilder method buildContent.
@Override
protected Optional<BrewingStand> buildContent(DataView container) throws InvalidDataException {
return super.buildContent(container).map(brewingStand -> {
if (!container.contains(BREW_TIME_QUERY)) {
throw new InvalidDataException("The provided container does not contain the data to make a Banner!");
}
// Have to consider custom names as an option
if (container.contains(DataQueries.CUSTOM_NAME)) {
((TileEntityBrewingStand) brewingStand).setName(container.getString(DataQueries.CUSTOM_NAME).get());
}
final BrewingStandData brewingData = Sponge.getDataManager().getManipulatorBuilder(BrewingStandData.class).get().create();
brewingData.remainingBrewTime().set(container.getInt(BREW_TIME_QUERY).get());
brewingStand.offer(brewingData);
((TileEntityBrewingStand) brewingStand).validate();
return brewingStand;
});
}
Aggregations