Class TravellingManager
java.lang.Object
com.minecolonies.core.colony.managers.TravellingManager
- All Implemented Interfaces:
ITravellingManager,net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
public class TravellingManager
extends Object
implements ITravellingManager, net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
Implementation of the travelling system and its API.
Keeps track of the travelling destination and progress of a given party.
Does not handle any interactions with the entities or the citizens.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeserializeNBT(net.minecraft.nbt.CompoundTag nbt) voidfinishTravellingFor(int citizenId) Triggers the cleanup of the travelling data when the citizen finishes travelling, either by design, or through an abort.Optional<net.minecraft.core.BlockPos>getTravellingTargetFor(int citizenId) Gets the travelling target, when travelling, for the citizen with the given id.booleanisTravelling(int citizenId) Indicates whether the citizen with the given id is travelling or not.booleanonTick()voidTriggers the recall of all travelling citizens regards of state of completion.net.minecraft.nbt.CompoundTagvoidstartTravellingTo(int citizenId, net.minecraft.core.BlockPos target, int travelTimeInTicks) Triggers the travelling logic for the citizen with the given id.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.minecolonies.api.colony.managers.interfaces.ITravellingManager
finishTravellingFor, getTravellingTargetFor, isTravelling, isTravelling, startTravellingTo
-
Constructor Details
-
TravellingManager
-
-
Method Details
-
isTravelling
public boolean isTravelling(int citizenId) Description copied from interface:ITravellingManagerIndicates whether the citizen with the given id is travelling or not.- Specified by:
isTravellingin interfaceITravellingManager- Parameters:
citizenId- The citizen id to check for.- Returns:
- True when travelling, false when not.
-
getTravellingTargetFor
Description copied from interface:ITravellingManagerGets the travelling target, when travelling, for the citizen with the given id.- Specified by:
getTravellingTargetForin interfaceITravellingManager- Parameters:
citizenId- The id of the citizen to get the target for.- Returns:
- An optional with the travelling target. The optional is empty when the citizen is not travelling.
-
startTravellingTo
public void startTravellingTo(int citizenId, net.minecraft.core.BlockPos target, int travelTimeInTicks) Description copied from interface:ITravellingManagerTriggers the travelling logic for the citizen with the given id.Does not despawn the entity. Discard it after calling this method.
- Specified by:
startTravellingToin interfaceITravellingManager- Parameters:
citizenId- The id of the citizen.target- The target to which the citizen is travelling, aka his respawn point.travelTimeInTicks- The time in ticks which needs to have passed for the travelling to complete.
-
finishTravellingFor
public void finishTravellingFor(int citizenId) Description copied from interface:ITravellingManagerTriggers the cleanup of the travelling data when the citizen finishes travelling, either by design, or through an abort.Does not spawn the entity. Trigger an entity update for the citizen to properly spawn it.
- Specified by:
finishTravellingForin interfaceITravellingManager- Parameters:
citizenId- The id of the citizen to stop the travelling for.
-
recallAllTravellingCitizens
public void recallAllTravellingCitizens()Description copied from interface:ITravellingManagerTriggers the recall of all travelling citizens regards of state of completion.- Specified by:
recallAllTravellingCitizensin interfaceITravellingManager
-
onTick
public boolean onTick() -
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>
-