//Get the world instance for the player's current location World world = player.getEntityWorld(); //Check if the block at the player's location is indirectly getting powered boolean isPowered = world.isBlockIndirectlyGettingPowered(player.getPosition(), 1); //Print the result to the console System.out.println("The block is indirectly powered: " + isPowered);
//Get the world instance for a specific dimension World world = MinecraftServer.getServer().worldServerForDimension(dimensionID); //Check if a block at a specific position is indirectly getting powered boolean isPowered = world.isBlockIndirectlyGettingPowered(new BlockPos(x, y, z), 15); //Print the result to the console System.out.println("The block at " + x + ", " + y + ", " + z + " is indirectly powered: " + isPowered);Package library: net.minecraft.world