mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-07 16:57:42 +01:00
#1186: Move getHighestBlockYAt methods from World to RegionAccessor
By: Jishuna <joshl5324@gmail.com>
This commit is contained in:
parent
7b7d756683
commit
3842cba3fd
@ -305,6 +305,26 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
|
|||||||
setBlockData(x, y, z, material.createBlockData());
|
setBlockData(x, y, z, material.createBlockData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getHighestBlockYAt(int x, int z) {
|
||||||
|
return getHighestBlockYAt(x, z, org.bukkit.HeightMap.MOTION_BLOCKING);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getHighestBlockYAt(Location location) {
|
||||||
|
return getHighestBlockYAt(location.getBlockX(), location.getBlockZ());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getHighestBlockYAt(int x, int z, org.bukkit.HeightMap heightMap) {
|
||||||
|
return getHandle().getHeight(CraftHeightMap.toNMS(heightMap), x, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getHighestBlockYAt(Location location, org.bukkit.HeightMap heightMap) {
|
||||||
|
return getHighestBlockYAt(location.getBlockX(), location.getBlockZ(), heightMap);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean generateTree(Location location, Random random, TreeType treeType) {
|
public boolean generateTree(Location location, Random random, TreeType treeType) {
|
||||||
BlockPosition pos = CraftLocation.toBlockPosition(location);
|
BlockPosition pos = CraftLocation.toBlockPosition(location);
|
||||||
|
@ -172,11 +172,6 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
|||||||
return CraftBlock.at(world, new BlockPosition(x, y, z));
|
return CraftBlock.at(world, new BlockPosition(x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getHighestBlockYAt(int x, int z) {
|
|
||||||
return getHighestBlockYAt(x, z, org.bukkit.HeightMap.MOTION_BLOCKING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Location getSpawnLocation() {
|
public Location getSpawnLocation() {
|
||||||
BlockPosition spawn = world.getSharedSpawnPos();
|
BlockPosition spawn = world.getSharedSpawnPos();
|
||||||
@ -708,11 +703,6 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
|||||||
return getBlockAt(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
return getBlockAt(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getHighestBlockYAt(Location location) {
|
|
||||||
return getHighestBlockYAt(location.getBlockX(), location.getBlockZ());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Chunk getChunkAt(Location location) {
|
public Chunk getChunkAt(Location location) {
|
||||||
return getChunkAt(location.getBlockX() >> 4, location.getBlockZ() >> 4);
|
return getChunkAt(location.getBlockX() >> 4, location.getBlockZ() >> 4);
|
||||||
@ -749,11 +739,6 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
|||||||
return world.getChunk(x >> 4, z >> 4).getHeight(CraftHeightMap.toNMS(heightMap), x, z);
|
return world.getChunk(x >> 4, z >> 4).getHeight(CraftHeightMap.toNMS(heightMap), x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getHighestBlockYAt(Location location, org.bukkit.HeightMap heightMap) {
|
|
||||||
return getHighestBlockYAt(location.getBlockX(), location.getBlockZ(), heightMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Block getHighestBlockAt(int x, int z, org.bukkit.HeightMap heightMap) {
|
public Block getHighestBlockAt(int x, int z, org.bukkit.HeightMap heightMap) {
|
||||||
return getBlockAt(x, getHighestBlockYAt(x, z, heightMap), z);
|
return getBlockAt(x, getHighestBlockYAt(x, z, heightMap), z);
|
||||||
|
@ -16,6 +16,7 @@ import net.minecraft.world.level.biome.BiomeBase;
|
|||||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||||
import net.minecraft.world.level.chunk.IChunkAccess;
|
import net.minecraft.world.level.chunk.IChunkAccess;
|
||||||
import net.minecraft.world.level.chunk.ProtoChunk;
|
import net.minecraft.world.level.chunk.ProtoChunk;
|
||||||
|
import org.bukkit.HeightMap;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.TreeType;
|
import org.bukkit.TreeType;
|
||||||
@ -198,6 +199,30 @@ public class CraftLimitedRegion extends CraftRegionAccessor implements LimitedRe
|
|||||||
super.setBlockData(x, y, z, blockData);
|
super.setBlockData(x, y, z, blockData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getHighestBlockYAt(int x, int z) {
|
||||||
|
Preconditions.checkArgument(isInRegion(x, region.getCenter().getBlockY(), z), "Coordinates %s, %s are not in the region", x, z);
|
||||||
|
return super.getHighestBlockYAt(x, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getHighestBlockYAt(Location location) {
|
||||||
|
Preconditions.checkArgument(isInRegion(location), "Coordinates %s, %s, %s are not in the region", location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||||
|
return super.getHighestBlockYAt(location);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getHighestBlockYAt(int x, int z, HeightMap heightMap) {
|
||||||
|
Preconditions.checkArgument(isInRegion(x, region.getCenter().getBlockY(), z), "Coordinates %s, %s are not in the region", x, z);
|
||||||
|
return super.getHighestBlockYAt(x, z, heightMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getHighestBlockYAt(Location location, HeightMap heightMap) {
|
||||||
|
Preconditions.checkArgument(isInRegion(location), "Coordinates %s, %s, %s are not in the region", location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||||
|
return super.getHighestBlockYAt(location, heightMap);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean generateTree(Location location, Random random, TreeType treeType) {
|
public boolean generateTree(Location location, Random random, TreeType treeType) {
|
||||||
Preconditions.checkArgument(isInRegion(location), "Coordinates %s, %s, %s are not in the region", location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
Preconditions.checkArgument(isInRegion(location), "Coordinates %s, %s, %s are not in the region", location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||||
|
Loading…
Reference in New Issue
Block a user