use of org.apache.tapestry5.Block in project NoCheatPlus by NoCheatPlus.
the class BlockCacheCB2922 method fetchBounds.
@Override
public double[] fetchBounds(final int x, final int y, final int z) {
// TODO: change api for this / use nodes (!)
@SuppressWarnings("deprecation") final int id = getType(x, y, z).getId();
final net.minecraft.server.v1_7_R1.Block block = net.minecraft.server.v1_7_R1.Block.e(id);
if (block == null)
return null;
// data from cache.
block.updateShape(iBlockAccess, x, y, z);
// minX, minY, minZ, maxX, maxY, maxZ
return new double[] { block.x(), block.z(), block.B(), block.y(), block.A(), block.C() };
}
use of org.apache.tapestry5.Block in project java-docs-samples by GoogleCloudPlatform.
the class Detect method detectDocumentText.
// [START vision_detect_document]
/**
* Performs document text detection on a local image file.
*
* @param filePath The path to the local file to detect document text on.
* @param out A {@link PrintStream} to write the results to.
* @throws Exception on errors while closing the client.
* @throws IOException on Input/Output errors.
*/
public static void detectDocumentText(String filePath, PrintStream out) throws Exception, IOException {
List<AnnotateImageRequest> requests = new ArrayList<>();
ByteString imgBytes = ByteString.readFrom(new FileInputStream(filePath));
Image img = Image.newBuilder().setContent(imgBytes).build();
Feature feat = Feature.newBuilder().setType(Type.DOCUMENT_TEXT_DETECTION).build();
AnnotateImageRequest request = AnnotateImageRequest.newBuilder().addFeatures(feat).setImage(img).build();
requests.add(request);
try (ImageAnnotatorClient client = ImageAnnotatorClient.create()) {
BatchAnnotateImagesResponse response = client.batchAnnotateImages(requests);
List<AnnotateImageResponse> responses = response.getResponsesList();
client.close();
for (AnnotateImageResponse res : responses) {
if (res.hasError()) {
out.printf("Error: %s\n", res.getError().getMessage());
return;
}
// For full list of available annotations, see http://g.co/cloud/vision/docs
TextAnnotation annotation = res.getFullTextAnnotation();
for (Page page : annotation.getPagesList()) {
String pageText = "";
for (Block block : page.getBlocksList()) {
String blockText = "";
for (Paragraph para : block.getParagraphsList()) {
String paraText = "";
for (Word word : para.getWordsList()) {
String wordText = "";
for (Symbol symbol : word.getSymbolsList()) {
wordText = wordText + symbol.getText();
out.format("Symbol text: %s (confidence: %f)\n", symbol.getText(), symbol.getConfidence());
}
out.format("Word text: %s (confidence: %f)\n\n", wordText, word.getConfidence());
paraText = String.format("%s %s", paraText, wordText);
}
// Output Example using Paragraph:
out.println("\nParagraph: \n" + paraText);
out.format("Paragraph Confidence: %f\n", para.getConfidence());
blockText = blockText + paraText;
}
pageText = pageText + blockText;
}
}
out.println("\nComplete annotation:");
out.println(annotation.getText());
}
}
}
use of org.apache.tapestry5.Block in project java-docs-samples by GoogleCloudPlatform.
the class Detect method detectDocumentTextGcs.
// [END vision_detect_document]
// [START vision_detect_document_uri]
/**
* Performs document text detection on a remote image on Google Cloud Storage.
*
* @param gcsPath The path to the remote file on Google Cloud Storage to detect document text on.
* @param out A {@link PrintStream} to write the results to.
* @throws Exception on errors while closing the client.
* @throws IOException on Input/Output errors.
*/
public static void detectDocumentTextGcs(String gcsPath, PrintStream out) throws Exception, IOException {
List<AnnotateImageRequest> requests = new ArrayList<>();
ImageSource imgSource = ImageSource.newBuilder().setGcsImageUri(gcsPath).build();
Image img = Image.newBuilder().setSource(imgSource).build();
Feature feat = Feature.newBuilder().setType(Type.DOCUMENT_TEXT_DETECTION).build();
AnnotateImageRequest request = AnnotateImageRequest.newBuilder().addFeatures(feat).setImage(img).build();
requests.add(request);
try (ImageAnnotatorClient client = ImageAnnotatorClient.create()) {
BatchAnnotateImagesResponse response = client.batchAnnotateImages(requests);
List<AnnotateImageResponse> responses = response.getResponsesList();
client.close();
for (AnnotateImageResponse res : responses) {
if (res.hasError()) {
out.printf("Error: %s\n", res.getError().getMessage());
return;
}
// For full list of available annotations, see http://g.co/cloud/vision/docs
TextAnnotation annotation = res.getFullTextAnnotation();
for (Page page : annotation.getPagesList()) {
String pageText = "";
for (Block block : page.getBlocksList()) {
String blockText = "";
for (Paragraph para : block.getParagraphsList()) {
String paraText = "";
for (Word word : para.getWordsList()) {
String wordText = "";
for (Symbol symbol : word.getSymbolsList()) {
wordText = wordText + symbol.getText();
out.format("Symbol text: %s (confidence: %f)\n", symbol.getText(), symbol.getConfidence());
}
out.format("Word text: %s (confidence: %f)\n\n", wordText, word.getConfidence());
paraText = String.format("%s %s", paraText, wordText);
}
// Output Example using Paragraph:
out.println("\nParagraph: \n" + paraText);
out.format("Paragraph Confidence: %f\n", para.getConfidence());
blockText = blockText + paraText;
}
pageText = pageText + blockText;
}
}
out.println("\nComplete annotation:");
out.println(annotation.getText());
}
}
}
use of org.apache.tapestry5.Block in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method b.
public static PathType b(IBlockAccess var0, int var1, int var2, int var3) {
PathType var4 = c(var0, var1, var2, var3);
if (var4 == PathType.OPEN && var2 >= 1) {
Block var5 = var0.getType(new BlockPosition(var1, var2 - 1, var3)).getBlock();
PathType var6 = c(var0, var1, var2 - 1, var3);
var4 = var6 != PathType.WALKABLE && var6 != PathType.OPEN && var6 != PathType.WATER && var6 != PathType.LAVA ? PathType.WALKABLE : PathType.OPEN;
if (var6 == PathType.DAMAGE_FIRE || var5 == Blocks.MAGMA_BLOCK || var5 == Blocks.CAMPFIRE) {
var4 = PathType.DAMAGE_FIRE;
}
if (var6 == PathType.DAMAGE_CACTUS) {
var4 = PathType.DAMAGE_CACTUS;
}
if (var6 == PathType.DAMAGE_OTHER) {
var4 = PathType.DAMAGE_OTHER;
}
if (var6 == PathType.STICKY_HONEY) {
var4 = PathType.STICKY_HONEY;
}
}
if (var4 == PathType.WALKABLE) {
var4 = a(var0, var1, var2, var3, var4);
}
return var4;
}
use of org.apache.tapestry5.Block in project Citizens2 by CitizensDev.
the class PlayerNavigation method s.
private int s() {
if ((!this.a.isInWater()) || (!h())) {
return (int) (this.a.getBoundingBox().b + 0.5D);
}
int j = (int) this.a.getBoundingBox().b;
Block localBlock = this.b.getType(new BlockPosition(MathHelper.floor(this.a.locX), j, MathHelper.floor(this.a.locZ))).getBlock();
int k = 0;
while ((localBlock == Blocks.FLOWING_WATER) || (localBlock == Blocks.WATER)) {
j++;
localBlock = this.b.getType(new BlockPosition(MathHelper.floor(this.a.locX), j, MathHelper.floor(this.a.locZ))).getBlock();
k++;
if (k > 16) {
return (int) this.a.getBoundingBox().b;
}
}
return j;
}
Aggregations