Interface DataBuilder<T extends DataSerializable>
- Type Parameters:
T- The type of data serializable this builder can build
- All Known Subinterfaces:
BannerPatternLayer.Builder, BlockEntityArchetype.Builder, BlockSnapshot.Builder, BlockState.Builder, Enchantment.Builder, EntityArchetype.Builder, EntitySnapshot.Builder, FluidStack.Builder, FluidStackSnapshot.Builder, FluidState.Builder, KeyValueMatcher.Builder<V>, LocatableBlock.Builder, ParticleEffect.Builder, PotionEffect.Builder, SerializableDataHolderBuilder<H,B>, SerializableDataHolderBuilder.Immutable<H, B>, SerializableDataHolderBuilder.Mutable<H, B>, State.Builder<S, B>, TradeOffer.Builder
- All Known Implementing Classes:
AbstractDataBuilder, Color.Builder, RespawnLocation.Builder
public interface DataBuilder<T extends DataSerializable>
Represents a builder that can take a
DataContainer and create a
new instance of a DataSerializable. The builder should be a
singleton and may not exist for every data serializable.
It is HIGHLY recommended to extend
AbstractDataBuilder as it implements content updating
-
Method Summary
-
Method Details
-
build
Attempts to build the providedDataSerializablefrom the givenDataView. If theDataViewis invalid or missing necessary information to complete building theDataSerializable,Optional.empty()may be returned.- Parameters:
container- The container containing all necessary data- Returns:
- The instance of the
DataSerializable, if successful - Throws:
InvalidDataException- In the event that the builder is unable to properly construct the data serializable from the data view
-