SpongePowered / Sponge

The SpongeAPI implementation targeting vanilla Minecraft and 3rd party platforms.
MIT License
390 stars 211 forks source link

Cannot cast to Sponge Biome #3955

Closed mosemister closed 6 months ago

mosemister commented 8 months ago

Affected Product(s)

SpongeVanilla

Version

1.19.4-10.0.0-RC1469

Operating System

Linux

Java Version

17

Plugins/Mods

Custom

Describe the bug

java.lang.ClassCastException: class net.minecraft.core.Holder$Reference cannot be cast to class org.spongepowered.api.world.biome.Biome (net.minecraft.core.Holder$Reference and org.spongepowered.api.world.biome.Biome are in unnamed module of loader cpw.mods.modlauncher.TransformingClassLoader @36061cf3)

Log:

    at net.minecraft.world.level.chunk.LevelChunk.biome(LevelChunk.java:1318) ~[?:?]
    at org.example.Example.getBiome(Example.java:120) ~[?:?]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
    at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
    at org.spongepowered.api.scheduler.Task$Builder.lambda$execute$0(Task.java:85) ~[?:?]
    at org.spongepowered.common.scheduler.SpongeScheduler.lambda$startTask$1(SpongeScheduler.java:274) ~[sponge.jar:1.19.4-10.0.0-RC1469]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
    at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
    at java.lang.Thread.run(Thread.java:840) ~[?:?]

Code:

WorldChunk chunk;
Vector3i blockMin = chunk.min();
var biome = chunk.biome(blockMin.add(0, 80, 0)); //<-- this line fails

Link to logs

No response