-
New Feature
-
Resolution: Fixed
-
Minor
-
None
-
None
-
None
-
CraftBukkit version 3627-Spigot-d90018e-c810c3e (MC: 1.19.3) (Implementing API version 1.19.3-R0.1-SNAPSHOT)
-
Yes
It is very difficult to check if a chunk contains a biome without using reflection and NMS. I believe this is the correct code that can be implemented for these features.
CraftChunk:
public boolean contains(org.bukkit.block.Biome biome) { Preconditions.checkArgument(biome != null, "Biome cannot be null"); Holder<net.minecraft.world.level.biome.Biome> biomeHolder = CraftBlock.biomeToBiomeBase(this.getHandle().biomeRegistry, biome); Predicate<Holder<net.minecraft.world.level.biome.Biome>> nms = Predicates.equalTo(biomeHolder); for (LevelChunkSection section : this.getHandle().getSections()) { if (section != null && section.getBiomes().maybeHas(nms)) { return true; } } return false; }
CraftChunkSnapshot:
public boolean contains(org.bukkit.block.Biome biome biome) { Preconditions.checkArgument(biome != null, "Biome cannot be null"); Holder<net.minecraft.world.level.biome.Biome> biomeHolder = CraftBlock.biomeToBiomeBase(biomeRegistry, biome); Predicate<Holder<net.minecraft.world.level.biome.Biome>> nms = Predicates.equalTo(biomeHolder); for(PalettedContainerRO<Holder<net.minecraft.world.level.biome.Biome>> palettedContainerRO : this.biome) { if(palettedContainerRO.maybeHas(nms)) { return true; } } return false; }