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

BlockVolume's highestYAt throws an error if the height is negative value. #3924

Open
masagameplay opened this issue Nov 19, 2023 · 1 comment
Labels
status: needs triage This label is automatically applied to new issues and pull requests to indicate they require triage type: bug Something isn't working

Comments

@masagameplay
Copy link
Contributor

masagameplay commented Nov 19, 2023

Affected Product(s)

SpongeForge, SpongeVanilla

Version

1.19.4-10.0.0-RC1407

Operating System

Windows 10

Java Version

Java 17

Plugins/Mods

A plugin that is tries to get highest block of given coordinates

Describe the bug

When using BlockVolume's highestYAt in a world with heights lower than 0, the following error occurs

java.lang.IllegalArgumentException: The value -16 is not in the specified inclusive range of 0 to 255
   at org.apache.commons.lang3.Validate.inclusiveBetween(Validate.java:1032) ~[?:?]
   at net.minecraft.util.SimpleBitStorage.get(SimpleBitStorage.java:184) ~[?:?]
   at net.minecraft.world.level.levelgen.Heightmap.getFirstAvailable(Heightmap.java:166) ~[?:?]
   at net.minecraft.world.level.levelgen.Heightmap.getHighestTaken(Heightmap.java:162) ~[?:?]
   at net.minecraft.world.level.chunk.LevelChunk.highestYAt(LevelChunk.java:1548) ~[?:?]

Link to logs

No response

@masagameplay masagameplay added status: needs triage This label is automatically applied to new issues and pull requests to indicate they require triage type: bug Something isn't working labels Nov 19, 2023
@AlexandreArcil
Copy link
Contributor

Hello, I tested with SpongeVanilla and I didn't have the error.

Here is my test code:

@Listener
private void onLogin(final ServerSideConnectionEvent.Join event) {
    Task build = Task.builder().plugin(this.container).delay(Ticks.of(20))
            .execute(() -> event.player().sendMessage(Component.text(event.player().world().highestYAt(-100, -100)))
            ).build();
    Sponge.game().asyncScheduler().submit(build);
}

and the result:
Capture

Try to update to the latest version of Sponge Vanilla, or give the plugin which throw the error please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This label is automatically applied to new issues and pull requests to indicate they require triage type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants