MCPcopy Index your code
hub / github.com/GregTech6/gregtech6 / prospectStone

Method prospectStone

src/main/java/gregapi/block/ToolCompat.java:391–437  ·  view source on GitHub ↗
(Block aBlock, byte aMeta, long aQuality, List<String> aChatReturn, World aWorld, byte aSide, int aX, int aY, int aZ)

Source from the content-addressed store, hash-verified

389 }
390
391 public static boolean prospectStone(Block aBlock, byte aMeta, long aQuality, List<String> aChatReturn, World aWorld, byte aSide, int aX, int aY, int aZ) {
392 Block tBlock;
393 int tX = aX, tY = aY, tZ = aZ, tQuality = (int)UT.Code.bind(1, 20, aQuality + 4);
394
395 for (int i = 0, j = tQuality; i < j; i++) {
396 tX -= OFFX[aSide];
397 tY -= OFFY[aSide];
398 tZ -= OFFZ[aSide];
399
400 // The Strings in this do not want to be localized, and not even Backup Lang wants to work.
401 tBlock = aWorld.getBlock(tX, tY, tZ);
402 if (tBlock == Blocks.lava || tBlock == Blocks.flowing_lava) {
403 if (aChatReturn != null) aChatReturn.add("There is Lava behind this Rock");
404 break;
405 }
406 if (tBlock instanceof BlockLiquid || tBlock instanceof IFluidBlock) {
407 if (aChatReturn != null) aChatReturn.add("There is a Fluid behind this Rock");
408 break;
409 }
410 if (tBlock instanceof BlockSilverfish || !WD.hasCollide(aWorld, tX, tY, tZ, tBlock)) {
411 if (aChatReturn != null) aChatReturn.add("There is an Air Pocket behind this Rock");
412 break;
413 }
414 if (i < 4) if (tBlock != aBlock || aMeta != aWorld.getBlockMetadata(tX, tY, tZ)) {
415 if (aChatReturn != null) aChatReturn.add("Material is changing behind this Rock");
416 break;
417 }
418 }
419
420 Random tRandom = new Random(aX^aY^aZ^aSide);
421 for (int i = 0, j = 1+2*tQuality, k = tQuality * tQuality; i < k; i++) {
422 tX = aX-tQuality+tRandom.nextInt(j);
423 tY = aY-tQuality+tRandom.nextInt(j);
424 tZ = aZ-tQuality+tRandom.nextInt(j);
425 tBlock = aWorld.getBlock(tX, tY, tZ);
426
427 if (tBlock != NB && tBlock != Blocks.obsidian && tBlock != BlocksGT.RockOres) {
428 OreDictItemData tAssotiation = OM.anyassociation((tBlock instanceof IBlockRetrievable ? ((IBlockRetrievable)tBlock).getItemStackFromBlock(aWorld, tX, tY, tZ, SIDE_INVALID) : ST.make(tBlock, 1, aWorld.getBlockMetadata(tX, tY, tZ))));
429 if (tAssotiation != null && tAssotiation.mPrefix.containsAny(TD.Prefix.STANDARD_ORE, TD.Prefix.DENSE_ORE)) {
430 if (aChatReturn != null) aChatReturn.add("Found traces of " + tAssotiation.mMaterial.mMaterial.getLocal());
431 return T;
432 }
433 }
434 }
435 if (aChatReturn != null && aChatReturn.isEmpty()) aChatReturn.add("No traces of Ore found");
436 return T;
437 }
438}

Callers 2

onToolClickMethod · 0.95
onToolClickMethod · 0.95

Calls 12

hasCollideMethod · 0.95
anyassociationMethod · 0.95
makeMethod · 0.95
bindMethod · 0.80
getBlockMetadataMethod · 0.80
nextIntMethod · 0.80
getBlockMethod · 0.65
addMethod · 0.65
getItemStackFromBlockMethod · 0.65
containsAnyMethod · 0.45
getLocalMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected