-
-
Notifications
You must be signed in to change notification settings - Fork 348
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/1.21' into final-datacomps
- Loading branch information
Showing
28 changed files
with
238 additions
and
107 deletions.
There are no files selected for viewing
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
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
22 changes: 22 additions & 0 deletions
22
src/datagen/generated/minecolonies/data/minecolonies/loot_table/recipes/glass_bottle.json
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,22 @@ | ||
{ | ||
"pools": [ | ||
{ | ||
"bonus_rolls": 0.0, | ||
"entries": [ | ||
{ | ||
"type": "minecraft:empty", | ||
"quality": -1, | ||
"weight": 100 | ||
}, | ||
{ | ||
"type": "minecraft:item", | ||
"name": "minecraft:glass_bottle", | ||
"quality": 1, | ||
"weight": 0 | ||
} | ||
], | ||
"rolls": 1.0 | ||
} | ||
], | ||
"random_sequence": "minecolonies:recipes/glass_bottle" | ||
} |
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
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
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
44 changes: 44 additions & 0 deletions
44
src/main/java/com/minecolonies/core/entity/pathfinding/navigation/PathfindingAIHelper.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,44 @@ | ||
package com.minecolonies.core.entity.pathfinding.navigation; | ||
|
||
import com.minecolonies.api.entity.other.AbstractFastMinecoloniesEntity; | ||
import com.minecolonies.api.util.BlockPosUtil; | ||
import com.minecolonies.core.entity.pathfinding.pathjobs.PathJobMoveCloseToXNearY; | ||
import net.minecraft.core.BlockPos; | ||
|
||
public class PathfindingAIHelper | ||
{ | ||
/** | ||
* Tries to walk close to a given pos, staying near another position. | ||
* | ||
* @param entity | ||
* @param desiredPosition | ||
* @param nearbyPosition | ||
* @param distToDesired | ||
* @return True while walking, false when reached | ||
*/ | ||
public static boolean walkCloseToXNearY( | ||
final AbstractFastMinecoloniesEntity entity, final BlockPos desiredPosition, | ||
final BlockPos nearbyPosition, | ||
final int distToDesired) | ||
{ | ||
final MinecoloniesAdvancedPathNavigate nav = ((MinecoloniesAdvancedPathNavigate) entity.getNavigation()); | ||
|
||
if (nav.isDone() || (nav.getPathResult() != null | ||
&& !(nav.getPathResult().getJob() instanceof PathJobMoveCloseToXNearY job | ||
&& job.nearbyPosition.equals(nearbyPosition) | ||
&& job.desiredPosition.equals(desiredPosition) | ||
&& job.distToDesired == distToDesired))) | ||
{ | ||
// Check distance once navigation is done, to let the entity walk | ||
if (BlockPosUtil.dist(entity.blockPosition(), desiredPosition) < distToDesired) | ||
{ | ||
return false; | ||
} | ||
|
||
PathJobMoveCloseToXNearY pathJob = new PathJobMoveCloseToXNearY(entity.level(), desiredPosition, nearbyPosition, distToDesired, entity); | ||
nav.setPathJob(pathJob, desiredPosition, 1.0, false); | ||
} | ||
|
||
return true; | ||
} | ||
} |
Oops, something went wrong.