This commit is contained in:
gnembon committed 2021-04-13 19:54:23 -03:00
1 parent 2cc2101934
commit cc3723ae12
4 files changed
+10 -10

No files matched your search

+1 -1
View File
@@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx1G
# check these on https://fabricmc.net/use
# or better: https://modmuss50.me/fabric.html
minecraft_version=21w14a
yarn_mappings=21w14a+build.2
yarn_mappings=21w14a+build.27
loader_version=0.11.3
fabric_version=0.32.7+1.17
@@ -23,18 +23,18 @@ public abstract class EntityNavigation_pathfindingMixin
@Shadow @Final protected MobEntity entity;
@Shadow protected @Nullable abstract Path method_35142(Set<BlockPos> set, int i, boolean bl, int j);
@Shadow protected @Nullable abstract Path findPathTo(Set<BlockPos> set, int i, boolean bl, int j);
@Redirect(method = "findPathTo(Lnet/minecraft/util/math/BlockPos;I)Lnet/minecraft/entity/ai/pathing/Path;", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/ai/pathing/EntityNavigation;method_35142(Ljava/util/Set;IZI)Lnet/minecraft/entity/ai/pathing/Path;"
target = "Lnet/minecraft/entity/ai/pathing/EntityNavigation;findPathTo(Ljava/util/Set;IZI)Lnet/minecraft/entity/ai/pathing/Path;"
))
private Path pathToBlock(EntityNavigation entityNavigation, Set<BlockPos> set_1, int int_1, boolean boolean_1, int int_2)
{
if (!LoggerRegistry.__pathfinding)
return method_35142(set_1, int_1, boolean_1, int_2);
return findPathTo(set_1, int_1, boolean_1, int_2);
long start = System.nanoTime();
Path path = method_35142(set_1, int_1, boolean_1, int_2);
Path path = findPathTo(set_1, int_1, boolean_1, int_2);
long finish = System.nanoTime();
float duration = (1.0F*((finish - start)/1000))/1000;
set_1.forEach(b -> PathfindingVisualizer.slowPath(entity, Vec3d.ofBottomCenter(b), duration, path != null)); // ground centered position
@@ -43,14 +43,14 @@ public abstract class EntityNavigation_pathfindingMixin
@Redirect(method = "findPathTo(Lnet/minecraft/entity/Entity;I)Lnet/minecraft/entity/ai/pathing/Path;", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/ai/pathing/EntityNavigation;method_35142(Ljava/util/Set;IZI)Lnet/minecraft/entity/ai/pathing/Path;"
target = "Lnet/minecraft/entity/ai/pathing/EntityNavigation;findPathTo(Ljava/util/Set;IZI)Lnet/minecraft/entity/ai/pathing/Path;"
))
private Path pathToEntity(EntityNavigation entityNavigation, Set<BlockPos> set_1, int int_1, boolean boolean_1, int int_2)
{
if (!LoggerRegistry.__pathfinding)
return method_35142(set_1, int_1, boolean_1, int_2);
return findPathTo(set_1, int_1, boolean_1, int_2);
long start = System.nanoTime();
Path path = method_35142(set_1, int_1, boolean_1, int_2);
Path path = findPathTo(set_1, int_1, boolean_1, int_2);
long finish = System.nanoTime();
float duration = (1.0F*((finish - start)/1000))/1000;
set_1.forEach(b -> PathfindingVisualizer.slowPath(entity, Vec3d.ofBottomCenter(b), duration, path != null));
@@ -130,7 +130,7 @@ public class Inventories {
{
ItemStack result = recipe.getOutput();
List<Value> ingredientValue = new ArrayList<>();
recipe.getPreviewInputs().forEach(
recipe.getIngredients().forEach(
ingredient ->
{
// I am flattening ingredient lists per slot.
@@ -206,7 +206,7 @@ public class ValueConversions
{
PathNode node = path.getNode(i);
nodes.add( ListValue.of(
new BlockValue(null, world, node.getPos()),
new BlockValue(null, world, node.getBlockPos()),
new StringValue(node.type.name().toLowerCase(Locale.ROOT)),
new NumericValue(node.penalty),
new NumericValue(node.visited)