use of net.minecraft.block.BlockOre in project Cavern2 by kegare.
the class OreCompass method findOrePos.
@Nullable
public static BlockPos findOrePos(@Nullable IBlockAccess world, @Nullable BlockPos origin, int range) {
if (world == null || origin == null || range <= 0) {
return null;
}
int dist = 0;
while (++dist < range) {
BlockPos from = origin.add(dist, 3, dist);
BlockPos to = origin.add(-dist, -3, -dist);
for (BlockPos pos : BlockPos.getAllInBoxMutable(from, to)) {
if (world.isAirBlock(pos)) {
continue;
}
IBlockState state = world.getBlockState(pos);
if (state.getBlock() instanceof BlockOre || state.getBlock() instanceof BlockRedstoneOre) {
return new BlockPos(pos);
}
if (MinerStats.getPointAmount(state) > 0) {
return new BlockPos(pos);
}
}
}
return null;
}
use of net.minecraft.block.BlockOre in project DynamicSurroundings by OreCruncher.
the class FootstepsRegistry method seedMap.
private void seedMap() {
// Iterate through the blockmap looking for known pattern types.
// Though they probably should all be registered with Forge
// dictionary it's not a requirement.
final Iterator<Block> itr = Block.REGISTRY.iterator();
while (itr.hasNext()) {
final Block block = itr.next();
final String blockName = MCHelper.nameOf(block);
if (block instanceof BlockCrops) {
final BlockCrops crop = (BlockCrops) block;
if (crop.getMaxAge() == 3) {
registerBlocks("#beets", blockName);
} else if (blockName.equals("minecraft:wheat")) {
registerBlocks("#wheat", blockName);
} else if (crop.getMaxAge() == 7) {
registerBlocks("#crop", blockName);
}
} else if (block instanceof BlockSapling) {
registerBlocks("#sapling", blockName);
} else if (block instanceof BlockReed) {
registerBlocks("#reed", blockName);
} else if (block instanceof BlockFence) {
registerBlocks("#fence", blockName);
} else if (block instanceof BlockFlower || block instanceof BlockMushroom) {
registerBlocks("NOT_EMITTER", blockName);
} else if (block instanceof BlockLog || block instanceof BlockPlanks) {
registerBlocks("wood", blockName);
} else if (block instanceof BlockDoor) {
registerBlocks("bluntwood", blockName);
} else if (block instanceof BlockLeaves) {
registerBlocks("leaves", blockName);
} else if (block instanceof BlockOre) {
registerBlocks("ore", blockName);
} else if (block instanceof BlockIce) {
registerBlocks("ice", blockName);
}
}
}
Aggregations