Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A Sniffer's Pathfinder does not respond to any commands #10442

Open
pontaoski opened this issue Apr 20, 2024 · 1 comment
Open

A Sniffer's Pathfinder does not respond to any commands #10442

pontaoski opened this issue Apr 20, 2024 · 1 comment
Labels
status: needs triage type: bug Something doesn't work as it was intended to. version: 1.20.4 Game version 1.20.4

Comments

@pontaoski
Copy link
Contributor

Expected behavior

Sniffer responds to pathfinding; i.e. API returns true if appropriate and Sniffer makes its way to the target

Observed/Actual behavior

Sniffer does not respond to pathfinding; API always returns false

Steps/models to reproduce

test plugin code:

public final class TestPlugin extends JavaPlugin implements Listener, CommandExecutor {
    class SnifferCommand extends Command {
        public SnifferCommand() {
            super("sniffer");
        }
        @Override
        public boolean execute(CommandSender sender, String label, String[] args) {
            var player = (Player)sender;
            var sniffer = (Sniffer)player.getWorld().spawnEntity(player.getLocation(), EntityType.SNIFFER);
            var pathfinder = sniffer.getPathfinder();
            sender.sendMessage(pathfinder.hasPath() ? "has path" : "has no path");
            var location = sniffer.getLocation();
            location.add(5, 0, 0);
            var result = pathfinder.moveTo(location);
            sender.sendMessage(result ? "could move to" : "could not move to");
            return true;
        }
    }
    @Override
    public void onEnable() {
        var snifferCommand = new SnifferCommand();
        this.getServer().getCommandMap().register("sniffer", snifferCommand);
        this.getServer().getPluginManager().registerEvents(this, this);
    }
}

run the sniffer command with adequate free space

Plugin and Datapack List

just the test plugin

Paper version

master (a6b6ecd)

Other

No response

@pontaoski pontaoski added status: needs triage type: bug Something doesn't work as it was intended to. labels Apr 20, 2024
@electronicboy
Copy link
Member

you may need to delay setting the path by a tick or two, as there's a whole bunch of state that these pathfinders rely upon which is not set until the entity is ticked; outside of that, this stuff is generally not really within our control as it's just interfacing with mojangs system

@kashike kashike added the version: 1.20.4 Game version 1.20.4 label Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage type: bug Something doesn't work as it was intended to. version: 1.20.4 Game version 1.20.4
Projects
Status: 🕑 Needs Triage
Development

No branches or pull requests

3 participants