-
-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'version/main' into feature/colony_expeditions_120
- Loading branch information
Showing
12 changed files
with
355 additions
and
222 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...avigation/IDynamicHeuristicNavigator.java → ...thfinding/IDynamicHeuristicNavigator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
src/main/java/com/minecolonies/api/entity/pathfinding/IMinecoloniesNavigator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package com.minecolonies.api.entity.pathfinding; | ||
|
||
import com.minecolonies.core.entity.pathfinding.navigation.MinecoloniesAdvancedPathNavigate; | ||
import com.minecolonies.core.entity.pathfinding.pathjobs.AbstractPathJob; | ||
import com.minecolonies.core.entity.pathfinding.pathresults.PathResult; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.entity.Mob; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
/** | ||
* Describes the Navigator used by minecolonies entities | ||
*/ | ||
public interface IMinecoloniesNavigator | ||
{ | ||
/** | ||
* Sets a new pathjob to execute | ||
* | ||
* @param job to run | ||
* @param dest | ||
* @param speedFactor | ||
* @param safeDestination | ||
* @param <T> | ||
* @return null or new pathresult | ||
*/ | ||
@Nullable | ||
<T extends AbstractPathJob> PathResult<T> setPathJob( | ||
@NotNull AbstractPathJob job, | ||
BlockPos dest, | ||
double speedFactor, boolean safeDestination); | ||
|
||
/** | ||
* Indirectly triggers a recalulation, by marking the navigator as done | ||
*/ | ||
void recalc(); | ||
|
||
/** | ||
* Returns the pathresult holding the current pathing task and result | ||
* | ||
* @return | ||
*/ | ||
PathResult getPathResult(); | ||
|
||
/** | ||
* Gets the safe destination the entity wants to travel to | ||
* | ||
* @return | ||
*/ | ||
BlockPos getSafeDestination(); | ||
|
||
/** | ||
* Gets the entity of the navigator | ||
* | ||
* @return | ||
*/ | ||
Mob getOurEntity(); | ||
|
||
/** | ||
* Pauses the navigator for X ticks from starting any new pathing tasks | ||
* | ||
* @param pauseTicks | ||
*/ | ||
void setPauseTicks(int pauseTicks); | ||
|
||
/** | ||
* Returns the stuck handler used by the navigator | ||
* | ||
* @return | ||
*/ | ||
IStuckHandler<MinecoloniesAdvancedPathNavigate> getStuckHandler(); | ||
} |
15 changes: 12 additions & 3 deletions
15
src/main/java/com/minecolonies/api/entity/pathfinding/IStuckHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,25 @@ | ||
package com.minecolonies.api.entity.pathfinding; | ||
|
||
import com.minecolonies.core.entity.pathfinding.navigation.AbstractAdvancedPathNavigate; | ||
import net.minecraft.world.entity.ai.navigation.PathNavigation; | ||
|
||
/** | ||
* Stuck handler for pathing, gets called to check/deal with stuck status | ||
*/ | ||
public interface IStuckHandler | ||
public interface IStuckHandler<NAV extends PathNavigation & IMinecoloniesNavigator> | ||
{ | ||
/** | ||
* Checks if the navigator is stuck | ||
* | ||
* @param navigator navigator to check | ||
*/ | ||
void checkStuck(final AbstractAdvancedPathNavigate navigator); | ||
void checkStuck(final NAV navigator); | ||
|
||
void resetGlobalStuckTimers(); | ||
|
||
/** | ||
* Returns the stuck level (0-9) indicating how long the entity is stuck and which stuck actions got used | ||
* | ||
* @return | ||
*/ | ||
public int getStuckLevel(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.