9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-25 18:09:27 +00:00

完善寻路

This commit is contained in:
XiaoMoMi
2025-07-05 19:36:31 +08:00
parent cf5a65e551
commit aa8295ae09
2 changed files with 7 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ import net.momirealms.craftengine.bukkit.plugin.reflection.minecraft.MItems;
import net.momirealms.craftengine.bukkit.util.BlockStateUtils;
import net.momirealms.craftengine.bukkit.util.MirrorUtils;
import net.momirealms.craftengine.bukkit.util.RotationUtils;
import net.momirealms.craftengine.core.block.BlockStateWrapper;
import net.momirealms.craftengine.core.block.CustomBlock;
import net.momirealms.craftengine.core.block.ImmutableBlockState;
import net.momirealms.craftengine.core.block.behavior.AbstractBlockBehavior;
@@ -177,6 +178,10 @@ public class BukkitBlockBehavior extends AbstractBlockBehavior {
@Override
public boolean isPathFindable(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
return args[isPathFindable$type] == CoreReflections.instance$PathComputationType$AIR && !FastNMS.INSTANCE.field$BlockBehavior$hasCollision(BlockStateUtils.getBlockOwner(args[0])) || super.isPathFindable(thisBlock, args, superMethod);
Optional<ImmutableBlockState> optionalCustomState = BlockStateUtils.getOptionalCustomBlockState(thisBlock);
if (optionalCustomState.isEmpty()) return false;
BlockStateWrapper vanillaState = optionalCustomState.get().vanillaBlockState();
if (vanillaState == null) return false;
return FastNMS.INSTANCE.method$BlockStateBase$isPathFindable(vanillaState.handle(), VersionHelper.isOrAbove1_20_5() ? null : args[1], VersionHelper.isOrAbove1_20_5() ? null : args[2], args[isPathFindable$type]);
}
}

View File

@@ -50,7 +50,7 @@ byte_buddy_version=1.17.5
ahocorasick_version=0.6.3
snake_yaml_version=2.4
anti_grief_version=0.18
nms_helper_version=1.0.27
nms_helper_version=1.0.28
evalex_version=3.5.0
reactive_streams_version=1.0.4
amazon_awssdk_version=2.31.23