Class AbstractDeliverymanRequestable
java.lang.Object
com.minecolonies.api.colony.requestsystem.requestable.deliveryman.AbstractDeliverymanRequestable
- All Implemented Interfaces:
IDeliverymanRequestable,IRequestable
public abstract class AbstractDeliverymanRequestable
extends Object
implements IDeliverymanRequestable
Abstract class for all deliveryman-requests
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractDeliverymanRequestable(int priority) Constructor for deliveryman requestables -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic intgetDefaultDeliveryPriority(boolean returnScaled) Gets the priority given to deliveries.static intgetMaxAgingPriority(boolean returnScaled) Gets the maximum priority the aging mechanism can assign.static intgetMaxBuildingPriority(boolean returnScaled) Gets the maximum priority allowed to be set in the building GUI.static intgetPlayerActionPriority(boolean returnScaled) Gets the priority given to the Request-Pickup-Now-feature TODO: Eventually, this should also affect the Postbox.intReturns the priority of the Requestable.inthashCode()voidThis will increment the priority due to the aging algorithm.static intscaledPriority(int priority) Scales the priority to the desired internal value.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.minecolonies.api.colony.requestsystem.requestable.IRequestable
getSuperClasses
-
Field Details
-
NBT_PRIORITY
- See Also:
-
NBT_DAY
- See Also:
-
NBT_QTY
- See Also:
-
MAX_BUILDING_PRIORITY
public static final int MAX_BUILDING_PRIORITY- See Also:
-
DEFAULT_DELIVERY_PRIORITY
protected static final int DEFAULT_DELIVERY_PRIORITY- See Also:
-
priority
protected int priority
-
-
Constructor Details
-
AbstractDeliverymanRequestable
protected AbstractDeliverymanRequestable(int priority) Constructor for deliveryman requestables- Parameters:
priority- The priority of the request. Higher priority equals earlier delivery/pickup
-
-
Method Details
-
scaledPriority
public static int scaledPriority(int priority) Scales the priority to the desired internal value. This is used so that the actual priorities are not just 1-10, but i.e. 1-100 (x^2) This will effectively make the aging-algorithm, which always increments by 1, slower. The function can be anything - a linear scaler, quadratic, exponential, whatever. Adapt over time to find the best solution. -
getMaxBuildingPriority
public static int getMaxBuildingPriority(boolean returnScaled) Gets the maximum priority allowed to be set in the building GUI. This is the "normal" setting available to players.- Parameters:
returnScaled- true if the value should be returned scaled- Returns:
- the scaled/unscaled priority
-
getDefaultDeliveryPriority
public static int getDefaultDeliveryPriority(boolean returnScaled) Gets the priority given to deliveries. This affects follow-up deliveries from crafters, and deliveries from the warehouse.- Parameters:
returnScaled- true if the value should be returned scaled- Returns:
- the scaled/unscaled priority
-
getMaxAgingPriority
public static int getMaxAgingPriority(boolean returnScaled) Gets the maximum priority the aging mechanism can assign. After that, priorities can not naturally increase.- Parameters:
returnScaled- true if the value should be returned scaled- Returns:
- the scaled/unscaled priority
-
getPlayerActionPriority
public static int getPlayerActionPriority(boolean returnScaled) Gets the priority given to the Request-Pickup-Now-feature TODO: Eventually, this should also affect the Postbox.- Parameters:
returnScaled- true if the value should be returned scaled- Returns:
- the scaled/unscaled priority
-
getPriority
public int getPriority()Description copied from interface:IDeliverymanRequestableReturns the priority of the Requestable. The higher the priority, the more urgent it is and the faster a deliveryman will handle it.- Specified by:
getPriorityin interfaceIDeliverymanRequestable- Returns:
- The current priority of the request
-
incrementPriorityDueToAging
public void incrementPriorityDueToAging()Description copied from interface:IDeliverymanRequestableThis will increment the priority due to the aging algorithm. This is important because it prevents starvation, making older requests successively more important.- Specified by:
incrementPriorityDueToAgingin interfaceIDeliverymanRequestable
-
equals
-
hashCode
public int hashCode()
-