mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-21 07:13:49 -07:00
Fix sniffer removeExploredLocation
Add support to remove explored location in different world
This commit is contained in:
@@ -34,12 +34,13 @@ public class CraftSniffer extends CraftAnimals implements Sniffer {
|
|||||||
@Override
|
@Override
|
||||||
public void removeExploredLocation(Location location) {
|
public void removeExploredLocation(Location location) {
|
||||||
Preconditions.checkArgument(location != null, "location cannot be null");
|
Preconditions.checkArgument(location != null, "location cannot be null");
|
||||||
if (location.getWorld() != this.getWorld()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
BlockPos blockPosition = CraftLocation.toBlockPosition(location);
|
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
|
@Override
|
||||||
|
Reference in New Issue
Block a user