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

[Bug] Biome not able to be fetched from CraftBiome.bukkitToMinecraft() #453

Open
6 tasks done
Dueris opened this issue Apr 11, 2024 · 0 comments
Open
6 tasks done
Labels
Status: Pending Issue/PR is currently awaiting approval by a moderator. Type: Bug Something isn't working as intended.

Comments

@Dueris
Copy link

Dueris commented Apr 11, 2024

Pre-Issue Checklist

  • I have checked that I am on the latest version of Terra.
  • I have searched the github issue tracker for similar issues, including
    closed ones.
  • I have made sure that this is not a bug with another mod or plugin, and it
    is Terra that is causing the issue.
  • I have checked that this is an issue with Terra and not an issue with the
    pack I am using.
  • I have attached a copy of the latest.log file
  • I have filled out and provided all the appropriate information.

Environment

Name Value
Terra Version Latest(6.4.3-BETA-bukkit - 1.20.4)
Platform / Platform Version Canvas(Purpur fork) 1.20.4
Any External Plugins or Mods GenesisMC, playit-gg, SkinsRestorer
Terra Packs In Use Origen
Terra Addons In Use none

Issue Description

When using the bukkitToMinecraft(Biome bukkit) method in CraftBiome to retrieve the NMS impl of the Biome, it returns null due to the NMS impl not being present in the CraftRegistry.getMinecraftRegistry().

Steps to reproduce

GenesisMC is the Paper plugin version of the Origins mod, and when running Biome conditions in a biome generated by terra, it fails to retrieve the Biome from the Pair<Biome, BlockPos> for the condition, because the Biome is null.
The NMS Biome and BlockPos Pair is created by this:
new oshi.util.tuples.Pair<Biome, BlockPos>(CraftBiome.bukkitToMinecraft(biome), CraftLocation.toBlockPosition(blockPos)))

The provided "biome" instance is of a org.bukkit.Biome which is given by blockPos.getBlock().getBiome(). The pair gets passed into the Condition tester and then throws null when attempting to access the Pairs "A" value(the biome). The condition being executed is the apoli "temperature" condition and is tested in the code bellow:

(condition, biome) -> {
            String comparison = condition.get("comparison").toString();
            float compare_to = Float.parseFloat(condition.get("compare_to").toString());
            return Comparison.getFromString(comparison).compare(biome.getA().getBaseTemperature(), compare_to);
        }

Line 50(the return statement) is where it throws, which is where it accesses biome.getA().
The github repo of GenesisMC is:

If the issue isnt actually fixable(or needs to be fixed), how can I access the NMS instance of the Biome provided by Terra, or find an alternate way to gain access to those features.

Expected behavior

The Biome should be returned correctly via CraftBiome.bukkitToMinecraft().

Actual behavior

Throws a NullPointerException

Full stacktrace

Exception Stacktrace
java.lang.NullPointerException: Cannot invoke "net.minecraft.world.level.biome.BiomeBase.g()" because the return value of "oshi.util.tuples.Pair.getA()" is null
	at me.dueris.genesismc.factory.conditions.types.BiomeConditions.lambda$prep$3(BiomeConditions.java:50) ~[genesis-mc1.20-v1.0.0.jar:?]
	at me.dueris.genesismc.factory.conditions.types.BiomeConditions$ConditionFactory.test(BiomeConditions.java:87) ~[genesis-mc1.20-v1.0.0.jar:?]
	at me.dueris.genesismc.factory.conditions.ConditionExecutor.testBiome(ConditionExecutor.java:201) ~[genesis-mc1.20-v1.0.0.jar:?]
	at me.dueris.genesismc.factory.conditions.types.EntityConditions.lambda$prep$46(EntityConditions.java:453) ~[genesis-mc1.20-v1.0.0.jar:?]
	at me.dueris.genesismc.factory.conditions.types.EntityConditions$ConditionFactory.test(EntityConditions.java:664) ~[genesis-mc1.20-v1.0.0.jar:?]
	at me.dueris.genesismc.factory.conditions.ConditionExecutor.testEntity(ConditionExecutor.java:394) ~[genesis-mc1.20-v1.0.0.jar:?]
	at me.dueris.genesismc.factory.powers.apoli.Burn.run(Burn.java:45) ~[genesis-mc1.20-v1.0.0.jar:?]
	at me.dueris.genesismc.OriginScheduler$OriginSchedulerTree.run(OriginScheduler.java:73) ~[genesis-mc1.20-v1.0.0.jar:?]
	at org.bukkit.craftbukkit.v1_20_R3.scheduler.CraftTask.run(CraftTask.java:101) ~[?:git-Canvas-"7b2242c"]
	at org.bukkit.craftbukkit.v1_20_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:482) ~[?:git-Canvas-"7b2242c"]
	at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1750) ~[?:git-Canvas-"7b2242c"]
	at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:511) ~[?:git-Canvas-"7b2242c"]
	at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1629) ~[?:git-Canvas-"7b2242c"]
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1316) ~[?:git-Canvas-"7b2242c"]
	at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:335) ~[?:git-Canvas-"7b2242c"]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]

latest.log

@Dueris Dueris added Status: Pending Issue/PR is currently awaiting approval by a moderator. Type: Bug Something isn't working as intended. labels Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Pending Issue/PR is currently awaiting approval by a moderator. Type: Bug Something isn't working as intended.
Projects
None yet
Development

No branches or pull requests

1 participant