use of thpmc.vanilla_source.api.world.parallel.ParallelChunk in project VanillaSource by TheHollowPlanetMC.
the class ImplParallelWorld method hasBlockData.
@Override
public boolean hasBlockData(int blockX, int blockY, int blockZ) {
int chunkX = blockX >> 4;
int chunkZ = blockZ >> 4;
long coord = ChunkUtil.getCoordinateKey(chunkX, chunkZ);
ParallelChunk parallelChunk = chunkMap.get(coord);
if (parallelChunk == null)
return false;
return parallelChunk.hasBlockData(blockX, blockY, blockZ);
}
use of thpmc.vanilla_source.api.world.parallel.ParallelChunk in project VanillaSource by TheHollowPlanetMC.
the class ImplParallelWorld method removeBlockData.
@Override
public void removeBlockData(int blockX, int blockY, int blockZ) {
int chunkX = blockX >> 4;
int chunkZ = blockZ >> 4;
long coord = ChunkUtil.getCoordinateKey(chunkX, chunkZ);
ParallelChunk parallelChunk = chunkMap.get(coord);
if (parallelChunk == null)
return;
parallelChunk.removeBlockData(blockX, blockY, blockZ);
}
use of thpmc.vanilla_source.api.world.parallel.ParallelChunk in project VanillaSource by TheHollowPlanetMC.
the class ImplParallelWorld method setType.
@Override
public void setType(int blockX, int blockY, int blockZ, Material material) {
int chunkX = blockX >> 4;
int chunkZ = blockZ >> 4;
long coord = ChunkUtil.getCoordinateKey(chunkX, chunkZ);
ParallelChunk parallelChunk = chunkMap.computeIfAbsent(coord, c -> new ImplParallelChunk(this, chunkX, chunkZ));
parallelChunk.setType(blockX, blockY, blockZ, material);
}
use of thpmc.vanilla_source.api.world.parallel.ParallelChunk in project VanillaSource by TheHollowPlanetMC.
the class ImplParallelWorld method hasBlockLight.
@Override
public boolean hasBlockLight(int blockX, int blockY, int blockZ) {
int chunkX = blockX >> 4;
int chunkZ = blockZ >> 4;
long coord = ChunkUtil.getCoordinateKey(chunkX, chunkZ);
ParallelChunk parallelChunk = chunkMap.get(coord);
if (parallelChunk == null)
return false;
return parallelChunk.hasBlockLight(blockX, blockY, blockZ);
}
use of thpmc.vanilla_source.api.world.parallel.ParallelChunk in project VanillaSource by TheHollowPlanetMC.
the class ImplEnginePlayer method setUniverse.
@Override
public synchronized void setUniverse(@Nullable ParallelUniverse parallelUniverse) {
if (currentUniverse == parallelUniverse)
return;
if (currentUniverse != null) {
((ImplParallelUniverse) currentUniverse).getPlayers().remove(this);
ParallelWorld currentWorld = currentUniverse.getWorld(player.getWorld().getName());
this.currentUniverse = parallelUniverse;
int range = Bukkit.getViewDistance();
int chunkX = player.getLocation().getBlockX() >> 4;
int chunkZ = player.getLocation().getBlockZ() >> 4;
for (int x = -range; x < range; x++) {
for (int z = -range; z < range; z++) {
ParallelChunk chunk = currentWorld.getChunk(chunkX + x, chunkZ + z);
if (chunk == null)
continue;
((ImplParallelChunk) chunk).sendClearPacket(player);
}
}
}
if (parallelUniverse != null) {
((ImplParallelUniverse) parallelUniverse).getPlayers().add(this);
ParallelWorld nextWorld = parallelUniverse.getWorld(player.getWorld().getName());
this.currentUniverse = parallelUniverse;
int range = Bukkit.getViewDistance();
int chunkX = player.getLocation().getBlockX() >> 4;
int chunkZ = player.getLocation().getBlockZ() >> 4;
for (int x = -range; x < range; x++) {
for (int z = -range; z < range; z++) {
ParallelChunk chunk = nextWorld.getChunk(chunkX + x, chunkZ + z);
if (chunk == null)
continue;
chunk.sendUpdate(player);
}
}
}
this.currentUniverse = parallelUniverse;
}
Aggregations