public Volume translateVolume(Volume volume, ForgeDirection direction) { if (direction == ForgeDirection.UNKNOWN) return volume; switch (direction) { case DOWN: volume = new Volume( volume.getMinX(), -volume.getMaxZ(), volume.getMinY(), volume.getMaxX(), volume.getMinZ(), volume.getMaxY()); break; case UP: volume = new Volume( volume.getMinX(), volume.getMinZ(), volume.getMinY(), volume.getMaxX(), volume.getMaxZ(), volume.getMaxY()); break; case NORTH: volume = new Volume( volume.getMinX(), volume.getMinY(), -volume.getMaxZ(), volume.getMaxX(), volume.getMaxY(), volume.getMinZ()); break; case WEST: volume = new Volume( -volume.getMaxZ(), volume.getMinY(), volume.getMinX(), volume.getMinZ(), volume.getMaxY(), volume.getMaxX()); break; case EAST: volume = new Volume( volume.getMinZ(), volume.getMinY(), volume.getMinX(), volume.getMaxZ(), volume.getMaxY(), volume.getMaxX()); break; case SOUTH: // The orientation on South is already the correct one, no translation needed. break; } return volume; }
public void sendClientUpdate( Volume updateVolume, BlockPos center, EntityPlayerMP player, ForgeDirection face) { World world = DimensionManager.getWorld(center.getDim()); int x, y, z; if (face != null) updateVolume = translateVolume(updateVolume, face); for (int i = updateVolume.getMinX(); i <= updateVolume.getMaxX(); i++) { for (int j = updateVolume.getMinY(); j <= updateVolume.getMaxY(); j++) { for (int k = updateVolume.getMinZ(); k <= updateVolume.getMaxZ(); k++) { x = center.getX() + i; y = center.getY() + j; z = center.getZ() + k; S23PacketBlockChange packet = new S23PacketBlockChange(x, y, z, world); packet.field_148884_e = world.getBlockMetadata(x, y, z); FMLCommonHandler.instance() .getMinecraftServerInstance() .getConfigurationManager() .sendPacketToAllPlayers(packet); } } } }
public int getArea(Volume rangeBox) { return ((rangeBox.getMaxX() - rangeBox.getMinX()) + 1) * ((rangeBox.getMaxY() - rangeBox.getMinY()) + 1) * ((rangeBox.getMaxZ() - rangeBox.getMinZ()) + 1); }