Class AbstractWrappedRequestManager
java.lang.Object
com.minecolonies.core.colony.requestsystem.management.manager.wrapped.AbstractWrappedRequestManager
- All Implemented Interfaces:
IRequestManager,ITickable,net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
- Direct Known Subclasses:
WrappedBlacklistAssignmentRequestManager,WrappedStaticStateRequestManager
Wrapper class for a Manager. Subclasses of this have custom behaviour on at least one method.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractWrappedRequestManager(@NotNull IStandardRequestManager wrappedManager) -
Method Summary
Modifier and TypeMethodDescriptionvoidassignRequest(@NotNull IToken<?> token) Method used to assign a request to a resolver.<T extends IRequestable>
@NotNull IToken<?>createAndAssignRequest(@NotNull IRequester requester, T object) Method used to create and immediately assign a request.<T extends IRequestable>
@NotNull IToken<?>createRequest(@NotNull IRequester requester, T object) Method to create a request for a given objectvoiddeserialize(IFactoryController controller, net.minecraft.network.FriendlyByteBuf buffer) deserialize this request manager from the giveFriendlyByteBufvoiddeserializeNBT(net.minecraft.nbt.CompoundTag nbt) @NotNull IColonyThe colony this manager manages the requests for.@NotNull IDataStoreManagerGet the data store manager.@NotNull IFactoryControllerMethod used to get the FactoryController of the RequestManager.@NotNull IPlayerRequestResolverGet the player resolve.@Nullable IRequest<?>getRequestForToken(@NotNull IToken<?> token) Method to get a request for a given token.@Nullable IRequestResolver<?>getResolverForRequest(@NotNull IToken<?> requestToken) Method to get a resolver for a given request.@NotNull IRequestResolver<?>getResolverForToken(@NotNull IToken<?> token) Method to get a resolver from its token.@NotNull IRetryingRequestResolverGet the retrying request resolver.booleanisDirty()Checks if dirty and needs to be updated.voidLog a debug message.voidMarks this manager dirty.voidonColonyUpdate(@NotNull Predicate<IRequest<?>> shouldTriggerReassign) Method used to indicate that a colony has updated their available items.voidonProviderAddedToColony(@NotNull IRequestResolverProvider provider) Method used to indicate to this manager that a new Provider has been added to the colony.voidonProviderRemovedFromColony(@NotNull IRequestResolverProvider provider) Method used to indicate to this manager that Provider has been removed from the colony.voidonRequesterRemovedFromColony(@NotNull IRequester requester) Method used to indicate to this manager that a Requster has been removed from the colony.voidoverruleRequest(@NotNull IToken<?> token, @Nullable net.minecraft.world.item.ItemStack stack) Method used to overrule a request.IToken<?>reassignRequest(@NotNull IToken<?> token, @NotNull Collection<IToken<?>> resolverTokenBlackList) Method used to reassign a given request.voidreset()Called to reset the RS.voidserialize(IFactoryController controller, net.minecraft.network.FriendlyByteBuf buffer) serialize this request manager to the giveFriendlyByteBufnet.minecraft.nbt.CompoundTagvoidsetDirty(boolean isDirty) Sets if dirty and needs to be updated.voidtick()Default parameterless ticking implementation.voidupdateRequestState(@NotNull IToken<?> token, @NotNull RequestState state) Method to update the state of a given request.
-
Field Details
-
wrappedManager
-
-
Constructor Details
-
AbstractWrappedRequestManager
-
-
Method Details
-
getColony
The colony this manager manages the requests for.- Specified by:
getColonyin interfaceIRequestManager- Returns:
- The colony this manager manages the requests for.
-
getFactoryController
Method used to get the FactoryController of the RequestManager.- Specified by:
getFactoryControllerin interfaceIRequestManager- Returns:
- The FactoryController of this RequestManager.
-
createRequest
@NotNull public <T extends IRequestable> @NotNull IToken<?> createRequest(@NotNull @NotNull IRequester requester, @NotNull T object) throws IllegalArgumentException Method to create a request for a given object- Specified by:
createRequestin interfaceIRequestManager- Type Parameters:
T- The type of request.- Parameters:
requester- The requester.object- The Object that is being requested.- Returns:
- The token representing the request.
- Throws:
IllegalArgumentException- is thrown when this manager cannot produce a request for the given types.
-
assignRequest
Method used to assign a request to a resolver.- Specified by:
assignRequestin interfaceIRequestManager- Parameters:
token- The token of the request to assign.- Throws:
IllegalArgumentException- when the token is not registered to a request, or is already assigned to a resolver.
-
createAndAssignRequest
@NotNull public <T extends IRequestable> @NotNull IToken<?> createAndAssignRequest(@NotNull @NotNull IRequester requester, @NotNull T object) throws IllegalArgumentException Method used to create and immediately assign a request.- Specified by:
createAndAssignRequestin interfaceIRequestManager- Type Parameters:
T- The type of the requestable- Parameters:
requester- The requester of the requestable.object- The requestable- Returns:
- The token that represents the request.
- Throws:
IllegalArgumentException- when either createRequest or assignRequest have thrown an IllegalArgumentException
-
reassignRequest
public IToken<?> reassignRequest(@NotNull @NotNull IToken<?> token, @NotNull @NotNull Collection<IToken<?>> resolverTokenBlackList) throws IllegalArgumentException Description copied from interface:IRequestManagerMethod used to reassign a given request.- Specified by:
reassignRequestin interfaceIRequestManager- Parameters:
token- The token of the request that should be reassigned.resolverTokenBlackList- the blacklist.- Returns:
- The token of the resolver that has gotten the assignment, null if none was found.
- Throws:
IllegalArgumentException- when the token is not known to this manager.
-
getRequestForToken
@Nullable public @Nullable IRequest<?> getRequestForToken(@NotNull @NotNull IToken<?> token) throws IllegalArgumentException Method to get a request for a given token.- Specified by:
getRequestForTokenin interfaceIRequestManager- Parameters:
token- The token to get a request for.- Returns:
- The request of the given type for that token.
- Throws:
IllegalArgumentException- when either their is no request with that token, or the token does not produce a request of the given type T.
-
getResolverForToken
@NotNull public @NotNull IRequestResolver<?> getResolverForToken(@NotNull @NotNull IToken<?> token) throws IllegalArgumentException Method to get a resolver from its token.- Specified by:
getResolverForTokenin interfaceIRequestManager- Parameters:
token- the token.- Returns:
- The resolver registered with the given token.
- Throws:
IllegalArgumentException- when the token is unknown.
-
getResolverForRequest
@Nullable public @Nullable IRequestResolver<?> getResolverForRequest(@NotNull @NotNull IToken<?> requestToken) throws IllegalArgumentException Method to get a resolver for a given request.- Specified by:
getResolverForRequestin interfaceIRequestManager- Parameters:
requestToken- The token of the request to get resolver for.- Returns:
- Null if the request is not yet resolved, or else the assigned resolver.
- Throws:
IllegalArgumentException- Thrown when the token is unknown.
-
updateRequestState
public void updateRequestState(@NotNull @NotNull IToken<?> token, @NotNull @NotNull RequestState state) throws IllegalArgumentException Method to update the state of a given request.- Specified by:
updateRequestStatein interfaceIRequestManager- Parameters:
token- The token that represents a given request to update.state- The new state of that request.- Throws:
IllegalArgumentException- when the token is unknown to this manager.
-
overruleRequest
public void overruleRequest(@NotNull @NotNull IToken<?> token, @Nullable @Nullable net.minecraft.world.item.ItemStack stack) throws IllegalArgumentException Description copied from interface:IRequestManagerMethod used to overrule a request. Updates the state and sets the delivery if applicable.- Specified by:
overruleRequestin interfaceIRequestManager- Parameters:
token- The token of the request that is being overruled.stack- The stack that should be treated as delivery. If no delivery is possible, this is null.- Throws:
IllegalArgumentException- Thrown when either token does not match to a request.
-
onProviderAddedToColony
public void onProviderAddedToColony(@NotNull @NotNull IRequestResolverProvider provider) throws IllegalArgumentException Method used to indicate to this manager that a new Provider has been added to the colony.- Specified by:
onProviderAddedToColonyin interfaceIRequestManager- Parameters:
provider- The new provider.- Throws:
IllegalArgumentException- is thrown when a provider with the same token is already registered.
-
onProviderRemovedFromColony
public void onProviderRemovedFromColony(@NotNull @NotNull IRequestResolverProvider provider) throws IllegalArgumentException Method used to indicate to this manager that Provider has been removed from the colony.- Specified by:
onProviderRemovedFromColonyin interfaceIRequestManager- Parameters:
provider- The removed provider.- Throws:
IllegalArgumentException- is thrown when no provider with the same token is registered.
-
onRequesterRemovedFromColony
public void onRequesterRemovedFromColony(@NotNull @NotNull IRequester requester) throws IllegalArgumentException Description copied from interface:IRequestManagerMethod used to indicate to this manager that a Requster has been removed from the colony.- Specified by:
onRequesterRemovedFromColonyin interfaceIRequestManager- Parameters:
requester- The removed requester.- Throws:
IllegalArgumentException- is thrown when no requester with the same token is registered.
-
getPlayerResolver
Description copied from interface:IRequestManagerGet the player resolve.- Specified by:
getPlayerResolverin interfaceIRequestManager- Returns:
- the player resolver object.
-
getRetryingRequestResolver
Description copied from interface:IRequestManagerGet the retrying request resolver.- Specified by:
getRetryingRequestResolverin interfaceIRequestManager- Returns:
- The retrying request resolver.
-
serializeNBT
public net.minecraft.nbt.CompoundTag serializeNBT()- Specified by:
serializeNBTin interfacenet.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
-
deserializeNBT
public void deserializeNBT(net.minecraft.nbt.CompoundTag nbt) - Specified by:
deserializeNBTin interfacenet.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
-
serialize
Description copied from interface:IRequestManagerserialize this request manager to the giveFriendlyByteBuf- Specified by:
serializein interfaceIRequestManager- Parameters:
controller- the controller.buffer- theFriendlyByteBufto serialize to.
-
deserialize
public void deserialize(IFactoryController controller, net.minecraft.network.FriendlyByteBuf buffer) Description copied from interface:IRequestManagerdeserialize this request manager from the giveFriendlyByteBuf- Specified by:
deserializein interfaceIRequestManager- Parameters:
controller- the controller.buffer- theFriendlyByteBufto deserialize from.
-
tick
public void tick()Description copied from interface:ITickableDefault parameterless ticking implementation. -
getDataStoreManager
Description copied from interface:IRequestManagerGet the data store manager.- Specified by:
getDataStoreManagerin interfaceIRequestManager- Returns:
- The data store manager.
-
reset
public void reset()Description copied from interface:IRequestManagerCalled to reset the RS.- Specified by:
resetin interfaceIRequestManager
-
isDirty
public boolean isDirty()Description copied from interface:IRequestManagerChecks if dirty and needs to be updated.- Specified by:
isDirtyin interfaceIRequestManager- Returns:
- true if so.
-
setDirty
public void setDirty(boolean isDirty) Description copied from interface:IRequestManagerSets if dirty and needs to be updated.- Specified by:
setDirtyin interfaceIRequestManager- Parameters:
isDirty- true if so.
-
markDirty
public void markDirty()Description copied from interface:IRequestManagerMarks this manager dirty.- Specified by:
markDirtyin interfaceIRequestManager
-
onColonyUpdate
Description copied from interface:IRequestManagerMethod used to indicate that a colony has updated their available items.- Specified by:
onColonyUpdatein interfaceIRequestManager- Parameters:
shouldTriggerReassign- The request assigned
-
log
Description copied from interface:IRequestManagerLog a debug message.- Specified by:
login interfaceIRequestManager- Parameters:
message- the message to log.
-