geforkt von Mirrors/Paper
SPIGOT-7214: Add CraftChunk and CraftChunkSnapshot contains biome method
By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
Ursprung
3b6d547a25
Commit
cbc24baf79
@ -40,6 +40,7 @@ import net.minecraft.world.level.lighting.LightEngine;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.ChunkSnapshot;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
@ -281,6 +282,20 @@ public class CraftChunk implements Chunk {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Biome biome) {
|
||||
Preconditions.checkArgument(biome != null, "Biome cannot be null");
|
||||
|
||||
Predicate<Holder<BiomeBase>> nms = Predicates.equalTo(CraftBlock.biomeToBiomeBase(getHandle().biomeRegistry, biome));
|
||||
for (ChunkSection section : getHandle().getSections()) {
|
||||
if (section != null && section.getBiomes().maybeHas(nms)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkSnapshot getChunkSnapshot() {
|
||||
return getChunkSnapshot(true, false, false);
|
||||
|
@ -81,6 +81,20 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Biome biome) {
|
||||
Preconditions.checkArgument(biome != null, "Biome cannot be null");
|
||||
|
||||
Predicate<Holder<BiomeBase>> nms = Predicates.equalTo(CraftBlock.biomeToBiomeBase(this.biomeRegistry, biome));
|
||||
for (PalettedContainerRO<Holder<BiomeBase>> palette : this.biome) {
|
||||
if (palette.maybeHas(nms)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material getBlockType(int x, int y, int z) {
|
||||
validateChunkCoordinates(x, y, z);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren