Class BuildingStable
java.lang.Object
com.minecolonies.core.colony.buildings.AbstractSchematicProvider
com.minecolonies.core.colony.buildings.AbstractBuildingContainer
com.minecolonies.core.colony.buildings.AbstractBuilding
com.minecolonies.core.colony.buildings.AbstractBuildingGuards
com.minecolonies.core.colony.buildings.workerbuildings.BuildingStable
- All Implemented Interfaces:
IBuilding,IBuildingContainer,ICommonBuilding,IGuardBuilding,ISchematicProvider,IBuildingModuleContainer,IModuleContainer<IBuildingModule>,IRequester,IRequestResolverProvider,IItemHandlerCapProvider,net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
Building of the stable.
Supports cavalry military units and the Stablemaster job.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe herding module for the stable.Nested classes/interfaces inherited from class com.minecolonies.core.colony.buildings.AbstractBuildingGuards
AbstractBuildingGuards.View -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatstatic final ISettingKey<IntSetting> Setting key for the patrol interval.Fields inherited from class com.minecolonies.core.colony.buildings.AbstractBuildingGuards
BASE_VISION_RANGE, BONUS_HEALTH_PER_LEVEL, FOLLOW_MODE, GUARD_TASK, HIRE_TRAINEE, HOSTILE_LIST, PATROL_MODE, patrolTargets, RETREAT, tempNextPatrolPoint, VISION_RANGE_PER_LEVELFields inherited from class com.minecolonies.core.colony.buildings.AbstractBuilding
BREEDING, modules, modulesMap, USE_SHEARSFields inherited from class com.minecolonies.core.colony.buildings.AbstractBuildingContainer
containerList, keepX, tileEntityFields inherited from class com.minecolonies.core.colony.buildings.AbstractSchematicProvider
colonyFields inherited from interface com.minecolonies.api.colony.buildings.IBuilding
WOOD_HUT_LEVELFields inherited from interface com.minecolonies.api.colony.buildings.IGuardBuilding
PATROL_DISTANCE -
Constructor Summary
ConstructorsConstructorDescriptionBuildingStable(@NotNull IColony colony, net.minecraft.core.BlockPos pos) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoiddeserializeNBT(net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound) Deserializes the compound tag and sets the last patrol time.longGets the last time the guards patrolled from this stable.net.minecraft.core.BlockPosGets the next stable position to use for a horse.intGets the patrol distance for cavalry guards assigned to this stable.protected net.minecraft.core.BlockPosGet a patrol target.Gets the schematic name of the building.getTask()Returns the task that the guards should perform when patrolling.intReturns the time in minutes since the last patrol from this stable.net.minecraft.core.BlockPospatrolPointForBuilding(net.minecraft.core.BlockPos targetPos) If the building structure includes potential patrol points, pick one and use it.net.minecraft.nbt.CompoundTagserializeNBT(net.minecraft.core.HolderLookup.Provider provider) Serializes the data of this building to NBT.voidsetLastPatrolTime(long lastPatrolTime) Sets the last time the guards patrolled from this stable.List<net.minecraft.core.BlockPos> Reads the tag positionsvoidInitiate the next patrol.Methods inherited from class com.minecolonies.core.colony.buildings.AbstractBuildingGuards
addPatrolTarget, arrivedAtPatrolPoint, calculateMobs, getBonusHealth, getBonusVision, getGuardPos, getMinePos, getNextPatrolTarget, getPlayerToFollowOrRally, getPositionToFollow, getRallyLocation, isTightGrouping, onColonyTick, onUpgradeComplete, requiresManualTarget, resetPatrolTargets, serializeToView, setGuardPos, setMinePos, setPatrolTimer, setPlayerToFollow, setRallyLocation, setTempNextPatrolPoint, shallPatrolManually, shallRetrieveOnLowHealthMethods inherited from class com.minecolonies.core.colony.buildings.AbstractBuilding
buildingRequiresCertainAmountOfItem, calculateCorners, calculatePrestige, canBeBuiltByBuilder, canBeGathered, cancelAllRequestsOfCitizenOrBuilding, canDeconstruct, clearDirty, createPickupRequest, createRequest, createRequest, createResolvers, deconstruct, destroy, forceTransferStack, getAllAssignedCitizen, getBuildingDisplayName, getCitizenForRequest, getClaimRadius, getClassType, getCompletedRequestsOfCitizenOrBuilding, getCompletedRequestsOfCitizenOrBuilding, getCompletedRequestsOfType, getCompletedRequestsOfTypeFiltered, getCraftingModuleForRecipe, getCustomName, getHandlers, getId, getLocation, getMaxBuildingLevel, getModule, getModule, getModules, getOpenRequests, getOpenRequestsByCitizen, getOpenRequestsByRequestableType, getOpenRequestsOfCitizenOrBuilding, getOpenRequestsOfType, getOpenRequestsOfTypeFiltered, getPrestige, getRequester, getRequesterDisplayName, getRequiredItemsAndAmount, getResolvers, getSetting, getSettingValueOrDefault, getTileEntity, hasCitizenCompletedRequests, hasCitizenCompletedRequestsToPickup, hasModule, hasOpenSyncRequest, hasWorkerOpenRequests, hasWorkerOpenRequestsFiltered, hasWorkerOpenRequestsOfType, isBuilt, isDirty, isGuardBuildingNear, isItemStackInRequest, isMatchingBlock, isPendingConstruction, keepFood, markDirty, markRequestAsAccepted, moveToSyncCitizen, onCleanUp, onDestroyed, onPlacement, onPlayerEnterBuilding, onPlayerEnterNearby, onRequestedRequestCancelled, onRequestedRequestComplete, onRestart, onWakeUp, overruleNextOpenRequestOfCitizenWithStack, overruleNextOpenRequestWithStack, pickUp, processOfflineTime, registerBlockPosition, registerModule, removeWorkOrder, requestRemoval, requestRepair, requestUpgrade, requestWorkOrder, reservedStacksExcluding, resetGuardBuildingNear, setCustomBuildingName, setupRsDataStore, writeRequestSystemToNBTMethods inherited from class com.minecolonies.core.colony.buildings.AbstractBuildingContainer
addContainerPosition, alterPickUpPriority, getContainers, getFirstLocationFromTag, getItemHandlerCap, getLocationsFromTag, getPickUpPriority, registerBlockPosition, removeContainerPosition, setTileEntityMethods inherited from class com.minecolonies.core.colony.buildings.AbstractSchematicProvider
asyncPrestigeRecalc, equals, getBlueprintPath, getBuildingLevel, getBuildingType, getChildren, getColony, getCorners, getID, getParent, getPosition, getRotationMirror, getStructurePack, hashCode, hasParent, isDeconstructed, isInBuilding, onUpgradeSchematicTo, safeUpdateTEDataFromSchematic, setBlueprintPath, setBuildingLevel, setBuildingType, setCorners, setDeconstructed, setParent, setRotationMirror, setStructurePack, upgradeBuildingLevelToSchematicDataMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.minecolonies.api.colony.buildings.IBuilding
asyncPrestigeRecalc, buildingRequiresCertainAmountOfItem, buildingRequiresCertainAmountOfItem, calculateCorners, calculatePrestige, canAssignCitizens, canBeBuiltByBuilder, canBeGathered, cancelAllRequestsOfCitizenOrBuilding, canEat, canSort, createPickupRequest, createRequest, createRequest, createResolvers, deconstruct, destroy, forceTransferStack, getAllAssignedCitizen, getBuildingDisplayName, getCitizenForRequest, getClaimRadius, getCompletedRequestsOfCitizenOrBuilding, getCompletedRequestsOfType, getCompletedRequestsOfTypeFiltered, getCustomName, getHandlers, getLocationsFromTag, getMaxEquipmentLevel, getOpenRequests, getOpenRequestsByRequestableType, getOpenRequestsOfType, getOpenRequestsOfTypeFiltered, getRequester, getRequiredItemsAndAmount, getResolvers, getSetting, getSettingValueOrDefault, hasCitizenCompletedRequests, hasCitizenCompletedRequestsToPickup, hasOpenSyncRequest, hasWorkerOpenRequests, hasWorkerOpenRequestsFiltered, hasWorkerOpenRequestsOfType, isBuilt, isGuardBuildingNear, isInBuilding, isItemStackInRequest, isMatchingBlock, isPendingConstruction, markDirty, markRequestAsAccepted, onCleanUp, onDestroyed, onPlacement, onPlayerEnterBuilding, onPlayerEnterNearby, onRestart, onWakeUp, overruleNextOpenRequestOfCitizenWithStack, overruleNextOpenRequestWithStack, pickUp, processOfflineTime, removeWorkOrder, requestRemoval, requestRepair, requestUpgrade, reservedStacksExcluding, resetGuardBuildingNear, setBuildingType, setCustomBuildingName, sort, upgradeBuildingLevelToSchematicData, writeToItemStackMethods inherited from interface com.minecolonies.api.colony.buildings.IBuildingContainer
addContainerPosition, alterPickUpPriority, getContainers, getPickUpPriority, getTileEntity, registerBlockPosition, registerBlockPosition, removeContainerPosition, setTileEntityMethods inherited from interface com.minecolonies.api.colony.modules.IBuildingModuleContainer
getModule, getModule, hasModule, registerModuleMethods inherited from interface com.minecolonies.api.colony.buildings.ICommonBuilding
getBuildingLevel, getBuildingLevelEquivalent, getBuildingType, getColony, getContainers, getPosition, getPrestigeMethods inherited from interface com.minecolonies.api.util.IItemHandlerCapProvider
getItemHandlerCap, getItemHandlerCap, getItemHandlerCapMethods inherited from interface com.minecolonies.api.colony.modules.IModuleContainer
getClassType, getFirstModuleOccurance, getModule, getModule, getModule, getModuleMatching, getModules, getModules, getModules, getModules, getModulesByType, hasModule, hasModule, hasModuleMethods inherited from interface com.minecolonies.api.colony.requestsystem.requester.IRequester
getId, getLocation, getRequesterDisplayName, onRequestedRequestCancelled, onRequestedRequestCompleteMethods inherited from interface com.minecolonies.api.colony.requestsystem.resolver.IRequestResolverProvider
getIdMethods inherited from interface com.minecolonies.api.colony.buildings.ISchematicProvider
clearDirty, getBlueprintPath, getChildren, getCorners, getID, getMaxBuildingLevel, getParent, getRotationMirror, getStructurePack, hasParent, isDeconstructed, isDirty, onUpgradeSchematicTo, setBlueprintPath, setBuildingLevel, setCorners, setDeconstructed, setParent, setRotationMirror, setStructurePack
-
Field Details
-
CAVALRY_PATROL_RANGE_BOOST
public static final float CAVALRY_PATROL_RANGE_BOOST- See Also:
-
PATROL_INTERVAL
Setting key for the patrol interval.
-
-
Constructor Details
-
BuildingStable
Constructor.- Parameters:
colony- the colony.pos- the position of the building.
-
-
Method Details
-
getSchematicName
Gets the schematic name of the building.- Returns:
- the schematic name of the building.
-
stallPositions
Reads the tag positions -
getNextStallPosition
public net.minecraft.core.BlockPos getNextStallPosition()Gets the next stable position to use for a horse. Just keeps iterating the aviable positions, so we do not have to keep track of what horse is where.- Returns:
- horse stable position
-
deserializeNBT
public void deserializeNBT(net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound) Deserializes the compound tag and sets the last patrol time.- Specified by:
deserializeNBTin interfaceIBuildingContainer- Specified by:
deserializeNBTin interfacenet.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>- Overrides:
deserializeNBTin classAbstractBuildingGuards- Parameters:
compound- the compound tag to read from.
-
serializeNBT
public net.minecraft.nbt.CompoundTag serializeNBT(net.minecraft.core.HolderLookup.Provider provider) Serializes the data of this building to NBT.- Specified by:
serializeNBTin interfaceIBuildingContainer- Specified by:
serializeNBTin interfacenet.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>- Overrides:
serializeNBTin classAbstractBuildingGuards- Returns:
- the serialized compound tag.
-
getTask
Returns the task that the guards should perform when patrolling.This can be either 'patrol', 'patrol_mine', or 'follow'.
The task is determined by the setting in the Stable Settings module.
- Specified by:
getTaskin interfaceIGuardBuilding- Overrides:
getTaskin classAbstractBuildingGuards- Returns:
- the task to perform when patrolling
-
getLastPatrolTime
public long getLastPatrolTime()Gets the last time the guards patrolled from this stable.- Returns:
- the game time of when the guards last patrolled.
-
setLastPatrolTime
public void setLastPatrolTime(long lastPatrolTime) Sets the last time the guards patrolled from this stable.- Parameters:
lastPatrolTime- the time in milliseconds since the epoch
-
minutesSinceLastPatrol
public int minutesSinceLastPatrol()Returns the time in minutes since the last patrol from this stable. This is based on the game time of the world.- Returns:
- the time in minutes since the last patrol.
-
getPatrolDistance
public int getPatrolDistance()Gets the patrol distance for cavalry guards assigned to this stable. This range is based on the base patrol distance of guards, and is multiplied by a constant to give cavalry guards a wider patrol range.- Specified by:
getPatrolDistancein interfaceIGuardBuilding- Overrides:
getPatrolDistancein classAbstractBuildingGuards- Returns:
- the patrol distance for cavalry guards assigned to this stable.
-
startPatrolNext
public void startPatrolNext()Initiate the next patrol.- Overrides:
startPatrolNextin classAbstractBuildingGuards
-
getRandomPatrolTarget
protected net.minecraft.core.BlockPos getRandomPatrolTarget()Get a patrol target.- Overrides:
getRandomPatrolTargetin classAbstractBuildingGuards- Returns:
- the next random patrol target.
-
patrolPointForBuilding
public net.minecraft.core.BlockPos patrolPointForBuilding(net.minecraft.core.BlockPos targetPos) If the building structure includes potential patrol points, pick one and use it. Otherwise, use the hut (or tagged ground-level) Y and nominate one of the exterior corners.- Parameters:
targetPos- the building position to patrol.- Returns:
- a patrol point designated by a tag, a building corner, or the target position.
-
cavalryPatrolFilter
-