1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-02-05 06:04:46 +01:00

Fix sniffer removeExploredLocation

Add support to remove explored location in different world
This commit is contained in:
Lulu13022002 2023-06-11 19:02:46 +02:00
parent 275331ae56
commit d22d2a19de

View file

@ -34,12 +34,13 @@ public class CraftSniffer extends CraftAnimals implements Sniffer {
@Override
public void removeExploredLocation(Location location) {
Preconditions.checkArgument(location != null, "location cannot be null");
if (location.getWorld() != this.getWorld()) {
return;
}
BlockPos blockPosition = CraftLocation.toBlockPosition(location);
this.getHandle().getBrain().setMemory(MemoryModuleType.SNIFFER_EXPLORED_POSITIONS, this.getHandle().getExploredPositions().filter(blockPositionExplored -> !blockPositionExplored.equals(blockPosition)).collect(Collectors.toList()));
// Paper start
net.minecraft.world.level.Level level = location.getWorld() != null ? ((org.bukkit.craftbukkit.CraftWorld) location.getWorld()).getHandle() : this.getHandle().level();
net.minecraft.core.GlobalPos globalPos = net.minecraft.core.GlobalPos.of(level.dimension(), blockPosition);
this.getHandle().getBrain().setMemory(MemoryModuleType.SNIFFER_EXPLORED_POSITIONS, this.getHandle().getExploredPositions().filter(blockPositionExplored -> !blockPositionExplored.equals(globalPos)).collect(Collectors.toList()));
// Paper end
}
@Override