public Vector3i sub(Vector3i v) { return sub(v.x, v.y, v.z); }
public Vector3i sub(Vector3i v) { return sub(v.x, v.y, v.z); }
public BlockBuffer(Vector3i min, Vector3i max) { this.min = min; this.max = max; this.size = this.max.sub(this.min).add(1, 1, 1); this.buffer = new char[this.size.getX() * this.size.getY() * this.size.getZ()]; Arrays.fill(this.buffer, Character.MAX_VALUE); }
public Vector3i sub(double x, double y, double z) { return sub(GenericMath.floor(x), GenericMath.floor(y), GenericMath.floor(z)); }
public Vector3i sub(double x, double y, double z) { return sub(GenericMath.floor(x), GenericMath.floor(y), GenericMath.floor(z)); }
public BlockOperation(CachedWorld world, Vector3i min, Vector3i max) { super(null); this.blockService = WebAPI.getBlockService(); this.uuid = UUID.randomUUID(); this.world = world; this.min = min; this.max = max; this.size = max.sub(min).add(1, 1, 1); this.cause = Cause.of(EventContext.empty(), WebAPI.getContainer()); this.totalBlocks = size.getX() * size.getY() * size.getZ(); }
computeRemoveBlockLight(toRemove.data.sub(1, 0, 0), toRemove.light, remove, spread, visitedRemove, visitedSpread); computeRemoveBlockLight(toRemove.data.add(1, 0, 0), toRemove.light, remove, spread, visitedRemove, visitedSpread); computeRemoveBlockLight(toRemove.data.sub(0, 1, 0), toRemove.light, remove, spread, visitedRemove, visitedSpread); computeRemoveBlockLight(toRemove.data.add(0, 1, 0), toRemove.light, remove, spread, visitedRemove, visitedSpread); computeRemoveBlockLight(toRemove.data.sub(0, 0, 1), toRemove.light, remove, spread, visitedRemove, visitedSpread); computeRemoveBlockLight(toRemove.data.add(0, 0, 1), toRemove.light, remove, spread, visitedRemove, visitedSpread); computeSpreadBlockLight(toSpread.sub(1, 0, 0), adjustedLight, spread, visitedSpread); computeSpreadBlockLight(toSpread.add(1, 0, 0), adjustedLight, spread, visitedSpread); computeSpreadBlockLight(toSpread.sub(0, 1, 0), adjustedLight, spread, visitedSpread); computeSpreadBlockLight(toSpread.add(0, 1, 0), adjustedLight, spread, visitedSpread); computeSpreadBlockLight(toSpread.sub(0, 0, 1), adjustedLight, spread, visitedSpread); computeSpreadBlockLight(toSpread.add(0, 0, 1), adjustedLight, spread, visitedSpread);
@Override protected final void powder(final SnipeData v) { if (this.pos == null) { v.sendMessage(TextColors.RED + "Select a first point with the arrow."); return; } v.sendMessage(TextColors.AQUA + "X change: " + (this.targetBlock.getX() - this.pos.getX())); v.sendMessage(TextColors.AQUA + "Y change: " + (this.targetBlock.getY() - this.pos.getY())); v.sendMessage(TextColors.AQUA + "Z change: " + (this.targetBlock.getZ() - this.pos.getZ())); final double distance = this.targetBlock.getBlockPosition().sub(this.pos).length(); v.sendMessage(TextColors.AQUA + "Distance = " + distance); }
Vector3i size = max.sub(min).add(1, 1, 1); int numBlocks = size.getX() * size.getY() * size.getZ();
private void testMutableBuffer(MutableBiomeVolume buffer) { final Vector3i min = buffer.getBiomeMin(); final Vector3i max = buffer.getBiomeMax(); // Test bound validation try { buffer.setBiome(min.sub(1, 0, 0), BiomeTypes.SKY); Assert.fail(); } catch (PositionOutOfBoundsException ignored) { } try { buffer.setBiome(max.add(1, 0, 0), BiomeTypes.SKY); Assert.fail(); } catch (PositionOutOfBoundsException ignored) { } // Test fill for (int x = min.getX(); x <= max.getX(); x++) { for (int z = min.getZ(); z <= max.getZ(); z++) { final BiomeType randomBiome = getRandomBiome(); buffer.setBiome(x, 0, z, randomBiome); Assert.assertEquals(randomBiome, buffer.getBiome(x, 0, z)); } } }
private void testMutableBuffer(MutableBlockVolume buffer) { final Vector3i min = buffer.getBlockMin(); final Vector3i max = buffer.getBlockMax(); // Test bound validation try { buffer.getBlock(min.sub(1, 0, 0)); Assert.fail(); } catch (PositionOutOfBoundsException ignored) { } try { buffer.getBlock(max.add(1, 0, 0)); Assert.fail(); } catch (PositionOutOfBoundsException ignored) { } // Test fill for (int x = min.getX(); x <= max.getX(); x++) { for (int y = min.getY(); y <= max.getY(); y++) { for (int z = min.getZ(); z <= max.getZ(); z++) { final BlockState randomBlock = getRandomBlock(); buffer.setBlock(x, y, z, randomBlock); Assert.assertEquals(randomBlock, buffer.getBlock(x, y, z)); } } } }
buffer.getBiome(min.sub(1, 0, 0)); Assert.fail(); } catch (PositionOutOfBoundsException ignored) {
buffer.getBlock(min.sub(1, 0, 0)); Assert.fail(); } catch (PositionOutOfBoundsException ignored) {