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 aDataContainer
and create a new instance of aDataSerializable
. 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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Optional<T>
build(DataView container)
Attempts to build the providedDataSerializable
from the givenDataView
.
-
-
-
Method Detail
-
build
Optional<T> build(DataView container) throws InvalidDataException
Attempts to build the providedDataSerializable
from the givenDataView
. If theDataView
is 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
-
-