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

Map updates are ignored after the first call to render() #11856

Open
Folas1337 opened this issue Dec 29, 2024 · 7 comments · May be fixed by #11865
Open

Map updates are ignored after the first call to render() #11856

Folas1337 opened this issue Dec 29, 2024 · 7 comments · May be fixed by #11865
Labels
status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. version: 1.21.4

Comments

@Folas1337
Copy link

Folas1337 commented Dec 29, 2024

Expected behavior

Map updates should not be ignored from updates after the initial call to render().

Observed/Actual behavior

Maps do not render unless you rejoin

Steps/models to reproduce

This GitHub issue is the whole conversation between me and the developer of ImageMaps. He even provides a way to reproduce the issue: SydMontague/ImageMaps#70

Plugin and Datapack List

Not really relevant, all you technically need is the ImageMaps plugin or the code they provided in the issue I linked above.

Paper version

[Sun 01:47:38 INFO ] Checking version, please wait...
[Sun 01:47:38 INFO ] This server is running Paper version 1.21.4-65-main@287eb52 (2024-12-28T23:19:11Z) (Implementing API version 1.21.4-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21.4-53-326c687 (MC: 1.21.4)

Other

No response

@Folas1337 Folas1337 changed the title Maps don't render on the initial call of render() Map updates are ignored on the initial call to render() Dec 29, 2024
@SydMontague
Copy link

The updates are ignored after the first call to render().

A simple MapRenderer with this code was able to reproduce the problem for me:

    @Override
    public void render(MapView view, MapCanvas canvas, Player player) {
        BufferedImage image = new BufferedImage(128, 128, BufferedImage.TYPE_INT_RGB);
        Graphics g = image.getGraphics();
        g.setColor(new Color((int) (Math.random() * 255)));
        g.fillRect(0, 0, 128, 128);
        canvas.drawImage(0, 0, image);
    }```

The maps should cycle between colors constantly, but they remain static. This does work as expected on Spigot.

@Folas1337 Folas1337 changed the title Map updates are ignored on the initial call to render() Map updates are ignored after the first call to render() Dec 29, 2024
@Folas1337
Copy link
Author

cough This is why I shouldn't open tickets from things I understand nothing about 😂

Thanks for the help though! :)

@electronicboy
Copy link
Member

From a 2 second glance, looks like mojang changed some of the logic here and that collides with an optimisation we have to not waste time doing stuff that won't be sent to the client?

@electronicboy
Copy link
Member

hm, no, nvm, it's not what I was looking at, that logic is still fine

@Folas1337
Copy link
Author

Thanks for taking a look, really curious as to why this started happening 🤔
Pretty mysterious bug we seem to be looking at here.

@Warriorrrr Warriorrrr added status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. and removed status: needs triage labels Dec 29, 2024
@Warriorrrr Warriorrrr linked a pull request Dec 29, 2024 that will close this issue
@Warriorrrr
Copy link
Member

The issue was within the drawImage method, there's an optimization in there to copy the image to the map in a more efficient manner, but doing so it was failing to mark the altered pixels as changed, causing them to not be sent to the client. I've created a PR that fixes this, and the reproduction code works fine with it.

@Folas1337
Copy link
Author

Wohooo, that sounds amazing. I'll also verify if it's working as the new build of paper comes out and if all is good I'll close this issue as well as the other one on the ImageMaps repo :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. version: 1.21.4
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants