use of net.minecraft.world.ChunkCache in project PneumaticCraft by MineMaarten.
the class AchievementHandler method checkFor9x9.
public static void checkFor9x9(EntityPlayer player, int x, int y, int z) {
ChunkCache cache = new ChunkCache(player.worldObj, x - 8, y, z - 8, x + 8, y, z + 8, 0);
ForgeDirection[] dirs = { ForgeDirection.NORTH, ForgeDirection.WEST };
for (ForgeDirection dir : dirs) {
int wallLength = 1;
int minX = x;
int minZ = z;
int maxX = x;
int maxZ = z;
int newX = x + dir.offsetX;
int newZ = z + dir.offsetZ;
while (wallLength < 9 && cache.getBlock(newX, y, newZ) == Blocks.cobblestone) {
wallLength++;
minX = Math.min(minX, newX);
minZ = Math.min(minZ, newZ);
maxX = Math.max(maxX, newX);
maxZ = Math.max(maxZ, newZ);
newX += dir.offsetX;
newZ += dir.offsetZ;
}
newX = x - dir.offsetX;
newZ = z - dir.offsetZ;
while (wallLength < 9 && cache.getBlock(newX, y, newZ) == Blocks.cobblestone) {
wallLength++;
minX = Math.min(minX, newX);
minZ = Math.min(minZ, newZ);
maxX = Math.max(maxX, newX);
maxZ = Math.max(maxZ, newZ);
newX -= dir.offsetX;
newZ -= dir.offsetZ;
}
if (wallLength == 9) {
if (checkFor9x9(cache, x, y, z, minX, minZ, maxX, maxZ)) {
giveAchievement(player, "dw9x9");
return;
}
}
}
}
use of net.minecraft.world.ChunkCache in project PneumaticCraft by MineMaarten.
the class ProgWidgetAreaItemBase method getCache.
public static IBlockAccess getCache(Collection<ChunkPosition> area, World world) {
if (area.size() == 0)
return world;
int minX, minY, minZ, maxX, maxY, maxZ;
Iterator<ChunkPosition> iterator = area.iterator();
ChunkPosition p = iterator.next();
minX = maxX = p.chunkPosX;
minY = maxY = p.chunkPosY;
minZ = maxZ = p.chunkPosZ;
while (iterator.hasNext()) {
p = iterator.next();
minX = Math.min(minX, p.chunkPosX);
minY = Math.min(minY, p.chunkPosY);
minZ = Math.min(minZ, p.chunkPosZ);
maxX = Math.max(maxX, p.chunkPosX);
maxY = Math.max(maxY, p.chunkPosY);
maxZ = Math.max(maxZ, p.chunkPosZ);
}
return new ChunkCache(world, minX, minY, minZ, maxX, maxY, maxZ, 0);
}
use of net.minecraft.world.ChunkCache in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class PhysicsObject method updateChunkCache.
public void updateChunkCache() {
BlockPos min = new BlockPos(collisionBB.minX, Math.max(collisionBB.minY, 0), collisionBB.minZ);
BlockPos max = new BlockPos(collisionBB.maxX, Math.min(collisionBB.maxY, 255), collisionBB.maxZ);
surroundingWorldChunksCache = new ChunkCache(worldObj, min, max, 0);
}
Aggregations